forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: tortech on November 29, 2013, 12:08:13 pm

Title: textbox and checkbox to accept terms of use
Post by: tortech on November 29, 2013, 12:08:13 pm
J would like to ask how to add on the main form two new controls:
textbox (with the text of terms of use)
checkbox.
These two new controls must be placed on the left or right side of text boxes where the user input the login and password.
J would like to input text of terms of use of my gallery.
Bellow must be placed checkbox. User must every time to check this control and agree with terms of use of this gallery.
Every time when user open gallery must be accept the terms of use, click the checkbox and input login and password.
Befory J send user login and password. User can not add new account.
Title: Re: textbox and checkbox to accept terms of use
Post by: Αndré on December 05, 2013, 09:58:12 am
These two new controls must be placed on the left or right side of text boxes where the user input the login and password.
Open login.php, find
Code: [Select]
starttable(-1, cpg_fetch_icon('login', 2) . $lang_login_php['enter_login_pswd'], 2);

//see how users are allowed to login, can be username, email address or both
$login_method = $lang_login_php[$CONFIG['login_method']];

echo <<< EOT
                  $login_failed
                  $cookie_warning
                  <tr>
                      <td class="tableb" width="40%">{$username_icon}{$login_method}</td>
                      <td class="tableb" width="60%"><input type="text" class="textinput" name="username" style="width: 100%" tabindex="1" /></td>
                  </tr>
                  <tr>
                      <td class="tableb">{$password_icon}{$lang_login_php['password']}</td>
                      <td class="tableb"><input type="password" class="textinput" name="password" style="width: 100%" tabindex="2" /></td>
                  </tr>
                  <tr>
                      <td colspan="2" align="center" class="tableb"><label for="remember_me">{$lang_login_php['remember_me']} </label><input name="remember_me" id="remember_me" type="checkbox" class="checkbox" value="1" tabindex="3" /></td>
                  </tr>
                  <tr>
                      <td align="center" class="tablef">
                          <a href="forgot_passwd.php" class="topmenu">{$lang_login_php['forgot_password_link']}</a>
                          $send_activation_link
                      </td>
                      <td align="left" class="tablef">
                        <!--<input name="submitted" type="submit" class="button" value="{$lang_login_php['login']}" tabindex="4" />-->
                        <button type="submit" class="button" name="submitted" value="{$lang_common['ok']}"  tabindex="4">{$ok_icon}{$lang_common['ok']}</button>
                      </td>
                  </tr>

EOT;

endtable();
and replace it with something like
Code: [Select]
starttable(-1, cpg_fetch_icon('login', 2) . $lang_login_php['enter_login_pswd'], 3);

//see how users are allowed to login, can be username, email address or both
$login_method = $lang_login_php[$CONFIG['login_method']];

echo <<< EOT
                  $login_failed
                  $cookie_warning
                  <tr>
                      <td class="tableb" width="20%">{$username_icon}{$login_method}</td>
                      <td class="tableb" width="30%"><input type="text" class="textinput" name="username" style="width: 100%" tabindex="1" /></td>
                      <td class="tableb" width="50%" rowspan="4">
                          <h1>Terms of use</h1>
                          Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
                          <br />
                          <input type="checkbox" name="tos" id="tos" tabindex="4" /> <label for="tos">Accept</label>
                      </td>
                  </tr>
                  <tr>
                      <td class="tableb">{$password_icon}{$lang_login_php['password']}</td>
                      <td class="tableb"><input type="password" class="textinput" name="password" style="width: 100%" tabindex="2" /></td>
                  </tr>
                  <tr>
                      <td colspan="2" align="center" class="tableb"><label for="remember_me">{$lang_login_php['remember_me']} </label><input name="remember_me" id="remember_me" type="checkbox" class="checkbox" value="1" tabindex="3" /></td>
                  </tr>
                  <tr>
                      <td align="center" class="tablef">
                          <a href="forgot_passwd.php" class="topmenu">{$lang_login_php['forgot_password_link']}</a>
                          $send_activation_link
                      </td>
                      <td align="left" class="tablef">
                        <!--<input name="submitted" type="submit" class="button" value="{$lang_login_php['login']}" tabindex="5" />-->
                        <button type="submit" class="button" name="submitted" value="{$lang_common['ok']}"  tabindex="5">{$ok_icon}{$lang_common['ok']}</button>
                      </td>
                  </tr>

EOT;

endtable();

Then, find
Code: [Select]
if ($USER_DATA = $cpg_udb->login($superCage->post->getEscaped('username'), $superCage->post->getEscaped('password'), $superCage->post->getInt('remember_me'))) {and replace it with
Code: [Select]
if ($superCage->post->keyExists('tos') && $USER_DATA = $cpg_udb->login($superCage->post->getEscaped('username'), $superCage->post->getEscaped('password'), $superCage->post->getInt('remember_me'))) {