D:\WEBSITES\testbed\252_zip\sources\LogInOut_08_27\LogInOut.pl D:\WEBSITES\testbed\cgi-bin\yabb252\Sources\LogInOut.pl
############################################################################### ###############################################################################
# LogInOut.pl                                                                 # # LogInOut.pl                                                                 #
############################################################################### ###############################################################################
# YaBB: Yet another Bulletin Board                                            # # YaBB: Yet another Bulletin Board                                            #
# Open-Source Community Software for Webmasters                               # # Open-Source Community Software for Webmasters                               #
# Version:        YaBB 2.5.2                                                  # # Version:        YaBB 2.5.2                                                  #
# Packaged:       September 30, 2012                                          # # Packaged:       September 30, 2012                                          #
# Distributed by: http://www.yabbforum.com                                    # # Distributed by: http://www.yabbforum.com                                    #
# =========================================================================== # # =========================================================================== #
# Copyright (c) 2000-2012 YaBB (www.yabbforum.com) - All Rights Reserved.     # # Copyright (c) 2000-2012 YaBB (www.yabbforum.com) - All Rights Reserved.     #
# Software by:  The YaBB Development Team                                     # # Software by:  The YaBB Development Team                                     #
#               with assistance from the YaBB community.                      # #               with assistance from the YaBB community.                      #
############################################################################### ###############################################################################
   
$loginoutplver = 'YaBB 2.5.2 $Revision: 1.0 $'; $loginoutplver = 'YaBB 2.5.2 $Revision: 1.0 $';
if ($action eq 'detailedversion') { return 1; } if ($action eq 'detailedversion') { return 1; }
   
if ($regcheck) { require "$sourcedir/Decoder.pl"; } if ($regcheck) { require "$sourcedir/Decoder.pl"; }
&LoadLanguage('LogInOut'); &LoadLanguage('LogInOut');
   
$regstyle = ''; $regstyle = '';
   
sub Login { sub Login {
     if (!$iamguest) { &fatal_error("logged_in_already",$username); }      if (!$iamguest) { &fatal_error("logged_in_already",$username); }
     $sharedLogin_title = $loginout_txt{'34'};      $sharedLogin_title = $loginout_txt{'34'};
     $yymain .= &sharedLogin . qq~<script type="text/javascript" language="JavaScript">      $yymain .= &sharedLogin . qq~<script type="text/javascript" language="JavaScript">
<!-- <!--
     document.loginform.username.focus();      document.loginform.username.focus();
//--> //-->
</script>~; </script>~;
     $yytitle = $loginout_txt{'34'};      $yytitle = $loginout_txt{'34'};
     &template;      &template;
} }
   
sub Login2 { sub Login2 {
     if (!$iamguest) { &fatal_error("logged_in_already",$username); }      if (!$iamguest) { &fatal_error("logged_in_already",$username); }
     &fatal_error("no_username") if ($FORM{'username'} eq "");      &fatal_error("no_username") if ($FORM{'username'} eq "");
     &fatal_error("no_password") if ($FORM{'passwrd'}  eq "");      &fatal_error("no_password") if ($FORM{'passwrd'}  eq "");
     $username = $FORM{'username'};      $username = $FORM{'username'};
     $username =~ s/\s/_/g;      $username =~ s/\s/_/g;
     &fatal_error("invalid_character","$loginout_txt{'35'} $loginout_txt{'241'}") if $username =~ /[^ \w\x80-\xFF\[\]\(\)#\%\+,\-\|\.:=\?\@\^]/;      &fatal_error("invalid_character","$loginout_txt{'35'} $loginout_txt{'241'}") if $username =~ /[^ \w\x80-\xFF\[\]\(\)#\%\+,\-\|\.:=\?\@\^]/;
     &fatal_error("only_numbers_allowed") if $FORM{'cookielength'} !~ /^[0-9]+$/;      &fatal_error("only_numbers_allowed") if $FORM{'cookielength'} !~ /^[0-9]+$/;
   
     ## Check if login ID is not and email address or screenname ##      ## Check if login ID is not and email address or screenname ##
     if (!-e "$memberdir/$username.vars"){      if (!-e "$memberdir/$username.vars"){
           $test_id = &MemberIndex("who_is", "$FORM{'username'}");            $test_id = &MemberIndex("who_is", "$FORM{'username'}");
           if ($test_id ne "") { $username = $test_id; } else { &fatal_error("bad_credentials"); }            if ($test_id ne "") { $username = $test_id; } else { &fatal_error("bad_credentials"); }
     }      }
     if (-e "$memberdir/$username.pre" && -e "$memberdir/$username.vars") { unlink "$memberdir/$username.pre"; }      if (-e "$memberdir/$username.pre" && -e "$memberdir/$username.vars") { unlink "$memberdir/$username.pre"; }
     if (-e "$memberdir/$username.pre" && ($regtype == 1 || $regtype == 2)) { &fatal_error('not_activated'); }      if (-e "$memberdir/$username.pre" && ($regtype == 1 || $regtype == 2)) { &fatal_error('not_activated'); }
   
     # Need to do this to get correct case of username,      # Need to do this to get correct case of username,
     # for case insensitive systems. Can cause weird issues otherwise      # for case insensitive systems. Can cause weird issues otherwise
     $caseright = 0;      $caseright = 0;
     &ManageMemberlist("load");      &ManageMemberlist("load");
     while (($curmemb, $value) = each(%memberlist)) {      while (($curmemb, $value) = each(%memberlist)) {
           if ($username =~ m/\A\Q$curmemb\E\Z/) { $caseright = 1; last; }            if ($username =~ m/\A\Q$curmemb\E\Z/) { $caseright = 1; last; }
     }      }
     undef %memberlist;      undef %memberlist;
     if(!$caseright) {      if(!$caseright) {
           $username = "Guest";            $username = "Guest";
           &fatal_error("bad_credentials");            &fatal_error("bad_credentials");
     }      }
   
     if (-e "$memberdir/$username.vars") {      if (-e "$memberdir/$username.vars") {
           &LoadUser($username);            &LoadUser($username);
           my $spass     = ${$uid.$username}{'password'};            my $spass     = ${$uid.$username}{'password'};
           my $cryptpass = &encode_password("$FORM{'passwrd'}");            my $cryptpass = &encode_password("$FORM{'passwrd'}");
   
           # convert non encrypted password to MD5 crypted one            # convert non encrypted password to MD5 crypted one
           if ($spass eq $FORM{'passwrd'} && $spass ne $cryptpass) {            if ($spass eq $FORM{'passwrd'} && $spass ne $cryptpass) {
                 # only encrypt the password if it's not already MD5 encrypted                  # only encrypt the password if it's not already MD5 encrypted
                 # MD5 hashes in YaBB are always 22 chars long (base64)                  # MD5 hashes in YaBB are always 22 chars long (base64)
                 if (length(${$uid.$username}{'password'}) != 22) {                  if (length(${$uid.$username}{'password'}) != 22) {
                       ${$uid.$username}{'password'} = $cryptpass;                        ${$uid.$username}{'password'} = $cryptpass;
                       &UserAccount($username);                        &UserAccount($username);
                       $spass = $cryptpass;                        $spass = $cryptpass;
                 }                  }
           }            }
           if ($spass ne $cryptpass) {            if ($spass ne $cryptpass) {
                 $username = "Guest";                  $username = "Guest";
                 &fatal_error("bad_credentials");                  &fatal_error("bad_credentials");
           }            }
     } else {      } else {
           $username = "Guest";            $username = "Guest";
           &fatal_error("bad_credentials");            &fatal_error("bad_credentials");
     }      }
   
     $iamadmin     = ${$uid.$username}{'position'} eq 'Administrator' ? 1 : 0;      $iamadmin     = ${$uid.$username}{'position'} eq 'Administrator' ? 1 : 0;
     $iamgmod      = ${$uid.$username}{'position'} eq 'Global Moderator' ? 1 : 0;      $iamgmod      = ${$uid.$username}{'position'} eq 'Global Moderator' ? 1 : 0;
     $sessionvalid = 1;      $sessionvalid = 1;
     $iamguest = 0;      $iamguest = 0;
   
     if ($maintenance && !$iamadmin) { $username = 'Guest'; &fatal_error("admin_login_only"); }      if ($maintenance && !$iamadmin) { $username = 'Guest'; &fatal_error("admin_login_only"); }
     &banning;      &banning;
   
     if ($FORM{'cookielength'} == 1) { $ck{'len'} = 'Sunday, 17-Jan-2038 00:00:00 GMT'; }      if ($FORM{'cookielength'} == 1) { $ck{'len'} = 'Sunday, 17-Jan-2038 00:00:00 GMT'; }
     elsif ($FORM{'cookielength'} == 2) { $ck{'len'} = ''; }      elsif ($FORM{'cookielength'} == 2) { $ck{'len'} = ''; }
     else { $ck{'len'} = "+$FORM{'cookielength'}m"; }      else { $ck{'len'} = "+$FORM{'cookielength'}m"; }
     ${$uid.$username}{'session'} = &encode_password($user_ip);      ${$uid.$username}{'session'} = &encode_password($user_ip);
     &UpdateCookie("write", $username, &encode_password($FORM{'passwrd'}), ${$uid.$username}{'session'}, "/", $ck{'len'});      &UpdateCookie("write", $username, &encode_password($FORM{'passwrd'}), ${$uid.$username}{'session'}, "/", $ck{'len'});
   
     &UserAccount($username, "update", "-"); # "-" to not update 'lastonline' here      &UserAccount($username, "update", "-"); # "-" to not update 'lastonline' here
     &buildIMS($username,'load'); # isn't loaded because was Guest before      &buildIMS($username,'load'); # isn't loaded because was Guest before
     &buildIMS($username,''); # rebuild the Members/$username.ims file on login      &buildIMS($username,''); # rebuild the Members/$username.ims file on login
   
     if($FORM{'sredir'}) {      if($FORM{'sredir'}) {
           $FORM{'sredir'} =~ s/\~/\=/g;            $FORM{'sredir'} =~ s/\~/\=/g;
           $FORM{'sredir'} =~ s/x3B/;/g;            $FORM{'sredir'} =~ s/x3B/;/g;
           $FORM{'sredir'} =~ s/search2/search/g;            $FORM{'sredir'} =~ s/search2/search/g;
           $FORM{'sredir'} = qq~?$FORM{'sredir'}~;            $FORM{'sredir'} = qq~?$FORM{'sredir'}~;
#           $FORM{'sredir'} = '' if $FORM{'sredir'} =~ /action=(register|login2)/; #           $FORM{'sredir'} = '' if $FORM{'sredir'} =~ /action=(register|login2)/;
           $FORM{'sredir'} = '' if $FORM{'sredir'} =~ /action=(register|login2|reminder|reminder2)/;            $FORM{'sredir'} = '' if $FORM{'sredir'} =~ /action=(register|login2|reminder|reminder2)/;
     }      }
     $yySetLocation = qq~$scripturl$FORM{'sredir'}~;      $yySetLocation = qq~$scripturl$FORM{'sredir'}~;
     &redirectexit;      &redirectexit;
} }
   
sub Logout { sub Logout {
     if ($username ne 'Guest') {      if ($username ne 'Guest') {
           &RemoveUserOnline($username); # Remove user from online log            &RemoveUserOnline($username); # Remove user from online log
           &UserAccount($username, "update", "lastonline");            &UserAccount($username, "update", "lastonline");
     }      }
   
     &UpdateCookie("delete");      &UpdateCookie("delete");
     $yySetLocation = $guestaccess ? $scripturl : qq~$scripturl?action=login~;      $yySetLocation = $guestaccess ? $scripturl : qq~$scripturl?action=login~;
     $username = 'Guest';      $username = 'Guest';
     &redirectexit;      &redirectexit;
} }
   
sub sharedLogin { sub sharedLogin {
     if ($action eq 'login' || $maintenance) {      if ($action eq 'login' || $maintenance) {
           $yynavigation = qq~&rsaquo; $loginout_txt{'34'}~;            $yynavigation = qq~&rsaquo; $loginout_txt{'34'}~;
           $border = qq~<div class="bordercolor" style="width: 100%; margin-bottom: 8px; margin-left: auto; margin-right: auto;">~;            $border = qq~<div class="bordercolor" style="width: 100%; margin-bottom: 8px; margin-left: auto; margin-right: auto;">~;
           $border_with_title = qq~<div class="bordercolor" style="width: 700px; margin-bottom: 8px; margin-left: auto; margin-right: auto;">~;            $border_with_title = qq~<div class="bordercolor" style="width: 700px; margin-bottom: 8px; margin-left: auto; margin-right: auto;">~;
           $border_bottom = qq~</div>~;            $border_bottom = qq~</div>~;
     }      }
   
     if    ($Cookie_Length == 1)    { $clsel1    = ' selected="selected"'; }      if    ($Cookie_Length == 1)    { $clsel1    = ' selected="selected"'; }
     elsif ($Cookie_Length == 2)    { $clsel2    = ' selected="selected"'; }      elsif ($Cookie_Length == 2)    { $clsel2    = ' selected="selected"'; }
     elsif ($Cookie_Length == 60)   { $clsel60   = ' selected="selected"'; }      elsif ($Cookie_Length == 60)   { $clsel60   = ' selected="selected"'; }
     elsif ($Cookie_Length == 180)  { $clsel180  = ' selected="selected"'; }      elsif ($Cookie_Length == 180)  { $clsel180  = ' selected="selected"'; }
     elsif ($Cookie_Length == 360)  { $clsel360  = ' selected="selected"'; }      elsif ($Cookie_Length == 360)  { $clsel360  = ' selected="selected"'; }
     elsif ($Cookie_Length == 480)  { $clsel480  = ' selected="selected"'; }      elsif ($Cookie_Length == 480)  { $clsel480  = ' selected="selected"'; }
     elsif ($Cookie_Length == 600)  { $clsel600  = ' selected="selected"'; }      elsif ($Cookie_Length == 600)  { $clsel600  = ' selected="selected"'; }
     elsif ($Cookie_Length == 720)  { $clsel720  = ' selected="selected"'; }      elsif ($Cookie_Length == 720)  { $clsel720  = ' selected="selected"'; }
     elsif ($Cookie_Length == 1440) { $clsel1440 = ' selected="selected"'; }      elsif ($Cookie_Length == 1440) { $clsel1440 = ' selected="selected"'; }
     if ($sharedLogin_title ne "") {      if ($sharedLogin_title ne "") {
           $sharedlog .= qq~            $sharedlog .= qq~
$border_with_title $border_with_title
<table cellpadding="4" cellspacing="1" border="0" width="100%" align="center"> <table cellpadding="4" cellspacing="1" border="0" width="100%" align="center">
     <tr><td class="titlebg" colspan="2"><b>$sharedLogin_title</b></td></tr>~;      <tr><td class="titlebg" colspan="2"><b>$sharedLogin_title</b></td></tr>~;
           if ($sharedLogin_text ne "") {            if ($sharedLogin_text ne "") {
                 $sharedlog .= qq~                  $sharedlog .= qq~
     <tr><td class="windowbg" colspan="2" align="left">$sharedLogin_text</td></tr>~;      <tr><td class="windowbg" colspan="2" align="left">$sharedLogin_text</td></tr>~;
           }            }
           $sharedlog .= qq~            $sharedlog .= qq~
     <tr>      <tr>
           <td class="windowbg2" colspan="2" align="center" valign="middle" style="padding: 10px;">~;            <td class="windowbg2" colspan="2" align="center" valign="middle" style="padding: 10px;">~;
     } else {      } else {
           $sharedlog .= qq~            $sharedlog .= qq~
$border $border
<table class="bordercolor" align="center" cellpadding="0" cellspacing="1" border="0" width="100%"> <table class="bordercolor" align="center" cellpadding="0" cellspacing="1" border="0" width="100%">
     <tr><td class="tabtitle" colspan="2" valign="middle" align="center" height="25">$loginout_txt{'34'}</td></tr>      <tr><td class="tabtitle" colspan="2" valign="middle" align="center" height="25">$loginout_txt{'34'}</td></tr>
     <tr>      <tr>
           <td class="windowbg" width="5%" valign="middle" align="center"><img src="$imagesdir/login.gif" border="0" alt="" /></td>            <td class="windowbg" width="5%" valign="middle" align="center"><img src="$imagesdir/login.gif" border="0" alt="" /></td>
           <td class="windowbg2" align="center" valign="middle" style="padding: 10px;">~;            <td class="windowbg2" align="center" valign="middle" style="padding: 10px;">~;
     }      }
   if ($maintenance) { $hide_passbutton = " visibility: hidden;"; }    if ($maintenance) { $hide_passbutton = " visibility: hidden;"; }
   if ($maintenance || !$regtype) { $hide_regbutton = " visibility: hidden;"; }    if ($maintenance || !$regtype) { $hide_regbutton = " visibility: hidden;"; }
     $sharedlog .= qq~      $sharedlog .= qq~
                 <form name="loginform" action="$scripturl?action=login2" method="post">                  <form name="loginform" action="$scripturl?action=login2" method="post">
                       <input type="hidden" name="sredir" value="$INFO{'sesredir'}" />                        <input type="hidden" name="sredir" value="$INFO{'sesredir'}" />
                       <div style="width: 600px;">                        <div style="width: 600px;">
                             <span style="float: left; width: 50%; text-align: left; margin-bottom: 5px;">                              <span style="float: left; width: 50%; text-align: left; margin-bottom: 5px;">
                                   <label for="username">$loginout_txt{'35'}</label>:<br />                                    <label for="username">$loginout_txt{'35'}</label>:<br />
                                   <input type="text" name="username" id="username" size="30" maxlength="100" style="width: 285px;" tabindex="1"$regstyle />                                    <input type="text" name="username" id="username" size="30" maxlength="100" style="width: 285px;" tabindex="1"$regstyle />
                             </span>                              </span>
                             <span style="float: left; width: 23%; text-align: center; margin-bottom: 5px;">                              <span style="float: left; width: 23%; text-align: center; margin-bottom: 5px;">
                                   &nbsp;                                    &nbsp;
                             </span>                              </span>
                             <span style="float: left; width: 27%; text-align: right; margin-bottom: 5px;">                              <span style="float: left; width: 27%; text-align: right; margin-bottom: 5px;">
                                   &nbsp;<br />                                    &nbsp;<br />
                                   <input type="button" value="$maintxt{'97'}" style="width: 160px;$hide_regbutton" onclick="location.href='$scripturl?action=register'" tabindex="6" class="button" />                                    <input type="button" value="$maintxt{'97'}" style="width: 160px;$hide_regbutton" onclick="location.href='$scripturl?action=register'" tabindex="6" class="button" />
                             </span>                              </span>
                       </div>                        </div>
                       <div style="width: 600px;">                        <div style="width: 600px;">
                             <span style="float: left; width: 29%; text-align: left; margin-bottom: 5px;">                              <span style="float: left; width: 29%; text-align: left; margin-bottom: 5px;">
                                   <label for="passwrd">$loginout_txt{'36'}</label>:<br />                                    <label for="passwrd">$loginout_txt{'36'}</label>:<br />
                                   <input type="password" name="passwrd" id="passwrd" size="15" maxlength="30" style="width: 110px;" tabindex="2" onkeypress="capsLock(event,'shared_login')" />                                    <input type="password" name="passwrd" id="passwrd" size="15" maxlength="30" style="width: 110px;" tabindex="2" onkeypress="capsLock(event,'shared_login')" />
                             </span>                              </span>
                             <span style="float: left; width: 21%; text-align: left; margin-bottom: 5px;">                              <span style="float: left; width: 21%; text-align: left; margin-bottom: 5px;">
                                   <label for="cookielength">$loginout_txt{'497'}</label>:<br />                                    <label for="cookielength">$loginout_txt{'497'}</label>:<br />
                                   <select name="cookielength" id="cookielength" style="width: 117px;" tabindex="3">                                    <select name="cookielength" id="cookielength" style="width: 117px;" tabindex="3">
                                   <option value="2"$clsel2>$loginout_txt{'497d'}</option>                                    <option value="2"$clsel2>$loginout_txt{'497d'}</option>
                                   <option value="1"$clsel1>$loginout_txt{'497c'}</option>                                    <option value="1"$clsel1>$loginout_txt{'497c'}</option>
                                   <option value="60"$clsel60>1 $loginout_txt{'497a'}</option>                                    <option value="60"$clsel60>1 $loginout_txt{'497a'}</option>
                                   <option value="180"$clsel180>3 $loginout_txt{'497b'}</option>                                    <option value="180"$clsel180>3 $loginout_txt{'497b'}</option>
                                   <option value="360"$clsel360>6 $loginout_txt{'497b'}</option>                                    <option value="360"$clsel360>6 $loginout_txt{'497b'}</option>
                                   <option value="480"$clsel480>8 $loginout_txt{'497b'}</option>                                    <option value="480"$clsel480>8 $loginout_txt{'497b'}</option>
                                   <option value="600"$clsel600>10 $loginout_txt{'497b'}</option>                                    <option value="600"$clsel600>10 $loginout_txt{'497b'}</option>
                                   <option value="720"$clsel720>12 $loginout_txt{'497b'}</option>                                    <option value="720"$clsel720>12 $loginout_txt{'497b'}</option>
                                   <option value="1440"$clsel1440>24 $loginout_txt{'497b'}</option>                                    <option value="1440"$clsel1440>24 $loginout_txt{'497b'}</option>
                                   </select>                                    </select>
                             </span>                              </span>
                             <span style="float: left; width: 23%; text-align: center; margin-bottom: 5px;">                              <span style="float: left; width: 23%; text-align: center; margin-bottom: 5px;">
                                   &nbsp;<br />                                    &nbsp;<br />
                                   <input type="submit" value="$loginout_txt{'34'}" tabindex="4" accesskey="l" style="width: 100px;" class="button" />                                    <input type="submit" value="$loginout_txt{'34'}" tabindex="4" accesskey="l" style="width: 100px;" class="button" />
                             </span>                              </span>
                             <span style="float: left; width: 27%; text-align: right; margin-bottom: 5px;">                              <span style="float: left; width: 27%; text-align: right; margin-bottom: 5px;">
                                   &nbsp;<br />                                    &nbsp;<br />
                                   <input type="button" value="$loginout_txt{'315'}" style="width: 160px;$hide_passbutton" onclick="location.href='$scripturl?action=reminder'" tabindex="5" class="button" />                                    <input type="button" value="$loginout_txt{'315'}" style="width: 160px;$hide_passbutton" onclick="location.href='$scripturl?action=reminder'" tabindex="5" class="button" />
                             </span>                              </span>
                             <br /><br />                              <br /><br />
                       </div>                        </div>
                       <div style="width: 600px; text-align: left; color: red; font-weight: bold; display: none" id="shared_login">$loginout_txt{'capslock'}</div>                        <div style="width: 600px; text-align: left; color: red; font-weight: bold; display: none" id="shared_login">$loginout_txt{'capslock'}</div>
                       <div style="width: 600px; text-align: left; color: red; font-weight: bold; display: none" id="shared_login_char">$loginout_txt{'wrong_char'}: <span id="shared_login_character">&nbsp;</span></div>                        <div style="width: 600px; text-align: left; color: red; font-weight: bold; display: none" id="shared_login_char">$loginout_txt{'wrong_char'}: <span id="shared_login_character">&nbsp;</span></div>
                 </form>                  </form>
           </td>            </td>
     </tr>      </tr>
</table> </table>
$border_bottom $border_bottom
~; ~;
   
     $loginform = 1;      $loginform = 1;
     $sharedLogin_title = '';      $sharedLogin_title = '';
     $sharedLogin_text = '';      $sharedLogin_text = '';
     return $sharedlog;      return $sharedlog;
} }
   
sub Reminder { sub Reminder {
     if (!$iamguest) { &fatal_error("logged_in_already",$username); }      if (!$iamguest) { &fatal_error("logged_in_already",$username); }
     $yymain .= qq~<br /><br />      $yymain .= qq~<br /><br />
<form action="$scripturl?action=reminder2" method="post" name="reminder" onsubmit="return CheckReminderField();"> <form action="$scripturl?action=reminder2" method="post" name="reminder" onsubmit="return CheckReminderField();">
<table border="0" width="400" cellspacing="1" cellpadding="3" align="center" class="bordercolor"> <table border="0" width="400" cellspacing="1" cellpadding="3" align="center" class="bordercolor">
     <tr>      <tr>
     <td class="titlebg">      <td class="titlebg">
     <span class="text1"><b>$mbname $loginout_txt{'36'} $loginout_txt{'194'}</b></span>      <span class="text1"><b>$mbname $loginout_txt{'36'} $loginout_txt{'194'}</b></span>
     </td>      </td>
     </tr><tr>      </tr><tr>
     <td class="windowbg">      <td class="windowbg">
     <label for="user"><span class="text1"><b>$loginout_txt{'35'}:</b></span></label>      <label for="user"><span class="text1"><b>$loginout_txt{'35'}:</b></span></label>
     <input type="text" name="user" id="user" $regstyle />      <input type="text" name="user" id="user" $regstyle size="50" />
     </td>      </td>
     </tr>      </tr>
~; ~;
   
     if ($regcheck) {      if ($regcheck) {
           &validation_code;            &validation_code;
           $yymain .= qq~            $yymain .= qq~
     <tr>      <tr>
     <td class="windowbg">      <td class="windowbg">
     <label for="verification"><span class="text1"><b>$floodtxt{'1'}: </b></span>      <label for="verification"><span class="text1"><b>$floodtxt{'1'}: </b></span>
     $showcheck      $showcheck
     <br /><span class="small">$floodtxt{'casewarning'}</span></label>      <br /><span class="small">$floodtxt{'casewarning'}</span></label>
     </td>      </td>
     </tr><tr>      </tr><tr>
     <td class="windowbg">      <td class="windowbg">
     <label for="verification"><span class="text1"><b>$floodtxt{'3'}: </b></span></label>      <label for="verification"><span class="text1"><b>$floodtxt{'3'}: </b></span></label>
     <span class="text1"><input type="text" maxlength="30" name="verification" id="verification" size="20" /></span>      <span class="text1"><input type="text" maxlength="30" name="verification" id="verification" size="20" /></span>
     </td>      </td>
     </tr>      </tr>
~; ~;
     }      }
     $yymain .= qq~      $yymain .= qq~
     <tr>      <tr>
     <td align="center" class="windowbg">      <td align="center" class="windowbg">
     <input type="submit" value="$loginout_txt{'339'}" class="button" />      <input type="submit" value="$loginout_txt{'339'}" class="button" />
     </td>      </td>
     </tr>      </tr>
</table> </table>
</form> </form>
<script type="text/javascript" language="JavaScript"> <script type="text/javascript" language="JavaScript">
<!-- <!--
   document.reminder.user.focus();    document.reminder.user.focus();
   
   function CheckReminderField() {    function CheckReminderField() {
       if (document.reminder.user.value == '') {        if (document.reminder.user.value == '') {
           alert("$loginout_txt{'error_user_info'}");            alert("$loginout_txt{'error_user_info'}");
           document.reminder.user.focus();            document.reminder.user.focus();
       return false;        return false;
       }        }
       return true;        return true;
   }    }
//--> //-->
</script> <br /><br /> </script> <br /><br />
~; ~;
   
     $yytitle = $loginout_txt{'669'};      $yytitle = $loginout_txt{'669'};
     $yynavigation = qq~&rsaquo; $loginout_txt{'669'}~;      $yynavigation = qq~&rsaquo; $loginout_txt{'669'}~;
     &template;      &template;
} }
   
sub Reminder2 { sub Reminder2 {
     if (!$FORM{'user'}) { &fatal_error("", "$loginout_txt{'error_user_info'}"); }      if (!$FORM{'user'}) { &fatal_error("", "$loginout_txt{'error_user_info'}"); }
     # generate random ID for password reset.      # generate random ID for password reset.
     if (!$iamguest) { &fatal_error("logged_in_already",$username); }      if (!$iamguest) { &fatal_error("logged_in_already",$username); }
     my $randid = &keygen(8,"A");      my $randid = &keygen(8,"A");
   
     if ($regcheck) {      if ($regcheck) {
           &validation_check($FORM{'verification'});            &validation_check($FORM{'verification'});
     }      }
   
     my $user = $FORM{'user'};      my $user = $FORM{'user'};
     $user =~ s/\s/_/g;      $user =~ s/\s/_/g;
   
     if (!-e "$memberdir/$user.vars"){      if (!-e "$memberdir/$user.vars"){
           $test_id = &MemberIndex("who_is", $user);             $test_id = &MemberIndex("who_is", $FORM{'user'}); 
           if ($test_id) { $user = $test_id; }                        if ($test_id) { $user = $test_id; }
           else { &fatal_error("", "$loginout_txt{'no_user_info_exists'}"); }            else { &fatal_error("", "$loginout_txt{'no_user_info_exists'}"); }
     }      }
   
     # Fix to make it load in their own language      # Fix to make it load in their own language
     &LoadUser($user);      &LoadUser($user);
     &fatal_error("corrupt_member_file") if !${$uid.$user}{'email'};      &fatal_error("corrupt_member_file") if !${$uid.$user}{'email'};
   
     $username = $user;      $username = $user;
     &WhatLanguage;      &WhatLanguage;
     &LoadLanguage('LogInOut');      &LoadLanguage('LogInOut');
     &LoadLanguage('Email');      &LoadLanguage('Email');
     undef $username;      undef $username;
   
     $userfound = 0;      $userfound = 0;
   
     if (-e "$memberdir/forgotten.passes") {      if (-e "$memberdir/forgotten.passes") {
           require "$memberdir/forgotten.passes";            require "$memberdir/forgotten.passes";
     }      }
     if (exists $pass{$user}) { delete $pass{$user}; }      if (exists $pass{$user}) { delete $pass{$user}; }
     $pass{"$user"} = $randid;      $pass{"$user"} = $randid;
   
     fopen(FILE, ">$memberdir/forgotten.passes") || &fatal_error("cannot_open","$memberdir/forgotten.passes", 1);      fopen(FILE, ">$memberdir/forgotten.passes") || &fatal_error("cannot_open","$memberdir/forgotten.passes", 1);
     while (($key, $value) = each(%pass)) {      while (($key, $value) = each(%pass)) {
           print FILE qq~\$pass{"$key"} = '$value';\n~;            print FILE qq~\$pass{"$key"} = '$value';\n~;
     }      }
     print FILE "1;";      print FILE "1;";
     fclose(FILE);      fclose(FILE);
   
     $subject = "$loginout_txt{'36'} $mbname: ${$uid.$user}{'realname'}";      $subject = "$loginout_txt{'36'} $mbname: ${$uid.$user}{'realname'}";
     if($do_scramble_id){$cryptusername = &cloak($user);} else {$cryptusername = $user; }      if($do_scramble_id){$cryptusername = &cloak($user);} else {$cryptusername = $user; }
     require "$sourcedir/Mailer.pl";      require "$sourcedir/Mailer.pl";
     &LoadLanguage('Email');      &LoadLanguage('Email');
     my $message = &template_email($passwordreminderemail, {'displayname' => ${$uid.$user}{'realname'}, 'cryptusername' => $cryptusername, 'remindercode' => $randid});      my $message = &template_email($passwordreminderemail, {'displayname' => ${$uid.$user}{'realname'}, 'cryptusername' => $cryptusername, 'remindercode' => $randid});
     &sendmail(${$uid.$user}{'email'}, $subject, $message);      &sendmail(${$uid.$user}{'email'}, $subject, $message);
   
     $yymain .= qq~<br /><br />      $yymain .= qq~<br /><br />
<table border="0" width="400" cellspacing="1" cellpadding="3" align="center" class="bordercolor"> <table border="0" width="400" cellspacing="1" cellpadding="3" align="center" class="bordercolor">
     <tr>      <tr>
     <td class="titlebg">      <td class="titlebg">
     <span class="text1"><b>$mbname $loginout_txt{'36'} $loginout_txt{'194'}</b></span>      <span class="text1"><b>$mbname $loginout_txt{'36'} $loginout_txt{'194'}</b></span>
     </td>      </td>
     </tr><tr>      </tr><tr>
     <td class="windowbg" align="center">      <td class="windowbg" align="center">
     <b>$loginout_txt{'192'} $FORM{'user'}</b></td>      <b>$loginout_txt{'192'} $FORM{'user'}</b></td>
     </tr>      </tr>
</table> </table>
<br /><p align="center"><a href="$scripturl">$maintxt{'go_to_board'}</a></p><br /> <br /><p align="center"><a href="$scripturl">$maintxt{'go_to_board'}</a></p><br />
   
~; ~;
     $yytitle = "$loginout_txt{'669'}";      $yytitle = "$loginout_txt{'669'}";
     &template;      &template;
} }
   
sub Reminder3 { sub Reminder3 {
     $id   = $INFO{'ID'};      $id   = $INFO{'ID'};
     if($do_scramble_id){$user = &decloak($INFO{'user'});} else { $user = $INFO{'user'};}      if($do_scramble_id){$user = &decloak($INFO{'user'});} else { $user = $INFO{'user'};}
   
     if ($id !~ /[a-zA-Z0-9]+/) { &fatal_error("invalid_character","ID $loginout_txt{'241'}"); }      if ($id !~ /[a-zA-Z0-9]+/) { &fatal_error("invalid_character","ID $loginout_txt{'241'}"); }
     if ($user =~ /[^\w#\%\+\-\.\@\^]/) { &fatal_error("invalid_character","User $loginout_txt{'241'}"); }      if ($user =~ /[^\w#\%\+\-\.\@\^]/) { &fatal_error("invalid_character","User $loginout_txt{'241'}"); }
   
     # generate a new random password as the old one is one-way encrypted.      # generate a new random password as the old one is one-way encrypted.
     @chararray = qw(0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z);      @chararray = qw(0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z);
     my $newpassword;      my $newpassword;
     for (my $i; $i < 8; $i++) {      for (my $i; $i < 8; $i++) {
           $newpassword .= $chararray[int(rand(61))];            $newpassword .= $chararray[int(rand(61))];
     }      }
   
     # load old userdata      # load old userdata
     &LoadUser($user);      &LoadUser($user);
   
     # update forgotten passwords database      # update forgotten passwords database
     require "$memberdir/forgotten.passes";      require "$memberdir/forgotten.passes";
     if ($pass{$user} ne $id) { &fatal_error("wrong_id"); }      if ($pass{$user} ne $id) { &fatal_error("wrong_id"); }
     delete $pass{$user};      delete $pass{$user};
     fopen(FORGOTTEN, ">$memberdir/forgotten.passes") || &fatal_error("cannot_open","$memberdir/forgotten.passes", 1);      fopen(FORGOTTEN, ">$memberdir/forgotten.passes") || &fatal_error("cannot_open","$memberdir/forgotten.passes", 1);
     while (($key, $value) = each(%pass)) {      while (($key, $value) = each(%pass)) {
           print FORGOTTEN qq~\$pass{"$key"} = '$value';\n~;            print FORGOTTEN qq~\$pass{"$key"} = '$value';\n~;
     }      }
     print FORGOTTEN "\n1;";      print FORGOTTEN "\n1;";
     fclose(FORGOTTEN);      fclose(FORGOTTEN);
   
     # add newly generated password to user data      # add newly generated password to user data
     ${$uid.$user}{'password'} = &encode_password($newpassword);      ${$uid.$user}{'password'} = &encode_password($newpassword);
     &UserAccount($user, "update");      &UserAccount($user, "update");
   
     $FORM{'username'} = $user;      $FORM{'username'} = $user;
     $FORM{'passwrd'} = $newpassword;      $FORM{'passwrd'} = $newpassword;
     $FORM{'cookielength'} = 10;      $FORM{'cookielength'} = 10;
     $FORM{'sredir'} = qq*action~profileCheck2;redir~myprofile;username~$INFO{'user'};passwrd~$newpassword;newpassword~1*;      $FORM{'sredir'} = qq*action~profileCheck2;redir~myprofile;username~$INFO{'user'};passwrd~$newpassword;newpassword~1*;
     &Login2;      &Login2;
} }
   
sub InMaintenance { sub InMaintenance {
     if ($maintenancetext ne "") { $maintxt{'157'} = $maintenancetext; }      if ($maintenancetext ne "") { $maintxt{'157'} = $maintenancetext; }
     $sharedLogin_title = "$maintxt{'114'}";      $sharedLogin_title = "$maintxt{'114'}";
     $sharedLogin_text  = "<b>$maintxt{'156'}</b><br />$maintxt{'157'}";      $sharedLogin_text  = "<b>$maintxt{'156'}</b><br />$maintxt{'157'}";
     $yymain .= &sharedLogin;      $yymain .= &sharedLogin;
     $yytitle = "$maintxt{'155'}";      $yytitle = "$maintxt{'155'}";
     &template;      &template;
} }
   
1; 1;