D:\my docs\My Received Files\Yabb\Yabb\YaBB_2.5_AEB\cgi-bin\yabb2_old\Sources\Sessions.pl D:\WEBSITES\testbed\cgi-bin\yabb252\Sources\Sessions.pl
############################################################################### ###############################################################################
# Sessions.pl                                                                 # # Sessions.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 Anniversary Edition                                # # Version:        YaBB 2.5.2                                                  #
# Packaged:       July 04, 2010                                               # # Packaged:       September 30, 2012                                          #
# Distributed by: http://www.yabbforum.com                                    # # Distributed by: http://www.yabbforum.com                                    #
# =========================================================================== # # =========================================================================== #
# Copyright (c) 2000-2010 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.                      #
# Sponsored by: Xnull Internet Media, Inc. - http://www.ximinc.com            #    
#               Your source for web hosting, web design, and domains.         #    
############################################################################### ###############################################################################
   
$sessionsplver = 'YaBB 2.5 AE $Revision: 1.8 $'; $sessionsplver = 'YaBB 2.5.2 $Revision: 1.2 $';
if ($action eq 'detailedversion') { return 1; } if ($action eq 'detailedversion') { return 1; }
   
&LoadLanguage('Sessions'); &LoadLanguage('Sessions');
   
sub SessionReval { sub SessionReval {
   if (${$uid.$username}{'sesquest'} eq "" || ${$uid.$username}{'sesquest'} eq "password") {    if (${$uid.$username}{'sesquest'} eq "" || ${$uid.$username}{'sesquest'} eq "password") {
       $sesremark   = qq~<br /><br /><fieldset><i>$session_txt{'10'}</i></fieldset>~;        $sesremark   = qq~<br /><br /><fieldset><i>$session_txt{'10'}</i></fieldset>~;
       $sesquestion = "password";        $sesquestion = "password";
       $sestype     = "password";        $sestype     = "password";
   } else {    } else {
       $sesremark   = "";        $sesremark   = "";
       $sesquestion = "${$uid.$username}{'sesquest'}";        $sesquestion = "${$uid.$username}{'sesquest'}";
       $sestype     = "text";        $sestype     = "text";
   }    }
   
   $yymain .= qq~    $yymain .= qq~
<br /><br /> <br /><br />
<form action="$scripturl?action=revalidatesession2" method="post" name="sesform"> <form action="$scripturl?action=revalidatesession2" method="post" name="sesform">
<div class="bordercolor" style="padding: 1px; width: 50%; margin-left: auto; margin-right: auto;"> <div class="bordercolor" style="padding: 1px; width: 50%; margin-left: auto; margin-right: auto;">
<table width="100%" cellspacing="0" cellpadding="3"> <table width="100%" cellspacing="0" cellpadding="3">
   <tr>    <tr>
       <td class="titlebg" colspan="3" align="left">        <td class="titlebg" colspan="3" align="left">
           <img src="$imagesdir/session.gif" alt="" /><b>$img_txt{'34a'}</b>            <img src="$imagesdir/session.gif" alt="" /><b>$img_txt{'34a'}</b>
       </td>        </td>
   </tr><tr>    </tr><tr>
       <td align="left" class="windowbg" colspan="3">        <td align="left" class="windowbg" colspan="3">
           $session_txt{'3'}<br /><br />$session_txt{'4'}$sesremark            $session_txt{'3'}<br /><br />$session_txt{'4'}$sesremark
       </td>        </td>
   </tr><tr>    </tr><tr>
       <td align="right" class="windowbg">        <td align="right" class="windowbg">
           <label for="sesanswer"><b>$sesquest_txt{$sesquestion}:</b></label>            <label for="sesanswer"><b>$sesquest_txt{$sesquestion}:</b></label>
       </td>        </td>
       <td align="left" class="windowbg">        <td align="left" class="windowbg">
           <input type="$sestype" name="sesanswer" id="sesanswer" size="20" tabindex="1" />            <input type="$sestype" name="sesanswer" id="sesanswer" size="20" tabindex="1" />
           <input type="hidden" name="sredir" value="$INFO{'sesredir'}" />            <input type="hidden" name="sredir" value="$INFO{'sesredir'}" />
       </td>        </td>
   </tr><tr>    </tr><tr>
       <td align="center" colspan="2" class="windowbg">        <td align="center" colspan="2" class="windowbg">
           <br />            <br />
           <input type="submit" value="$img_txt{'34a'}" tabindex="2" class="button" /></td>            <input type="submit" value="$img_txt{'34a'}" tabindex="2" class="button" /></td>
   </tr>    </tr>
</table> </table>
</div> </div>
</form> </form>
<script type="text/javascript" language="JavaScript"> <script type="text/javascript" language="JavaScript">
<!-- <!--
   document.sesform.sesanswer.focus();    document.sesform.sesanswer.focus();
//--> //-->
</script> </script>
~; ~;
   $yytitle = "$img_txt{'34a'}";    $yytitle = "$img_txt{'34a'}";
   &template;    &template;
} }
   
sub SessionReval2 { sub SessionReval2 {
   require "$sourcedir/Decoder.pl";    require "$sourcedir/Decoder.pl";
   $FORM{'cookielength'}   = 360;    $FORM{'cookielength'}   = 360;
   $FORM{'cookieneverexp'} = 1;    $FORM{'cookieneverexp'} = 1;
   &fatal_error("no_secret_answer") if ($FORM{'sesanswer'} eq "");     if ( $FORM{'sesanswer'} eq q{} ) { fatal_error('no_secret_answer'); } 
   if (${$uid.$username}{'sesquest'} eq "" || ${$uid.$username}{'sesquest'} eq "password") {     if (   ${ $uid . $username }{'sesquest'} eq q{} 
       $question = ${$uid.$username}{'password'};         || ${ $uid . $username }{'sesquest'} eq 'password' ) 
       $answer   = &encode_password("$FORM{'sesanswer'}");     { 
       chomp $answer;         $question = ${ $uid . $username }{'password'}; 
   } else {         $answer   = encode_password("$FORM{'sesanswer'}"); 
       $question = ${$uid.$username}{'sesanswer'};         chomp $answer; 
       $answer = &scramble($FORM{'sesanswer'}, $username);     } 
       chomp $answer;     else { 
   }         $question = descramble(${ $uid.$username }{'sesanswer'}, $username); 
   if ($answer ne $question) {          $answer = $FORM{'sesanswer'};  
       &UpdateCookie("delete");  #       bug fix courtesy Derek Barnstorm; 
  #        $question = ${ $uid . $username }{'sesanswer'};  
       $username           = 'Guest';  #        $answer = scramble( "$FORM{'sesanswer'}", $username ); 
       $iamguest           = '1';         chomp $answer; 
       $iamadmin           = '';     } 
       $iamgmod            = '';     if ($answer ne $question) { 
       $password           = '';         &UpdateCookie("delete"); 
       $yyim               = '';    
       $ENV{'HTTP_COOKIE'} = '';         $username           = 'Guest'; 
       $yyuname            = '';         $iamguest           = '1'; 
       $formsession        = &cloak("$mbname$username");         $iamadmin           = ''; 
         $iamgmod            = '';  
       require "$sourcedir/LogInOut.pl";         $password           = ''; 
       $sharedLogin_text   = $session_txt{'6'};         $yyim               = ''; 
       $action             = "login";         $ENV{'HTTP_COOKIE'} = ''; 
       &Login;         $yyuname            = ''; 
   } else {         $formsession        = &cloak("$mbname$username"); 
       $iamadmin     = ${$uid.$username}{'position'} eq 'Administrator' ? 1 : 0;    
       $iamgmod      = ${$uid.$username}{'position'} eq 'Global Moderator' ? 1 : 0;         require "$sourcedir/LogInOut.pl"; 
       $sessionvalid = 1;         $sharedLogin_text   = $session_txt{'6'}; 
   }         $action             = "login"; 
   if ($FORM{'cookielength'} < 1 || $FORM{'cookielength'} > 9999) { $FORM{'cookielength'} = $Cookie_Length; }         &Login; 
   if (!$FORM{'cookieneverexp'}) { $ck{'len'} = "\+$FORM{'cookielength'}m"; }      } else {  
   else { $ck{'len'} = 'Sunday, 17-Jan-2038 00:00:00 GMT'; }         $iamadmin     = ${$uid.$username}{'position'} eq 'Administrator' ? 1 : 0; 
   ${$uid.$username}{'session'} = &encode_password($user_ip);         $iamgmod      = ${$uid.$username}{'position'} eq 'Global Moderator' ? 1 : 0; 
   chomp ${$uid.$username}{'session'};         $sessionvalid = 1; 
   &UserAccount($username, "update");     } 
   &UpdateCookie("write", $username, ${$uid.$username}{'password'}, ${$uid.$username}{'session'}, "/", $ck{'len'});     if ($FORM{'cookielength'} < 1 || $FORM{'cookielength'} > 9999) { $FORM{'cookielength'} = $Cookie_Length; } 
     if (!$FORM{'cookieneverexp'}) { $ck{'len'} = "\+$FORM{'cookielength'}m"; }  
   $redir = "";     else { $ck{'len'} = 'Sunday, 17-Jan-2038 00:00:00 GMT'; } 
   if($FORM{'sredir'}) {     ${$uid.$username}{'session'} = &encode_password($user_ip); 
       my $tmpredir = $FORM{'sredir'};     chomp ${$uid.$username}{'session'}; 
       $tmpredir =~ s/\~/\=/g;     &UserAccount($username, "update"); 
       $tmpredir =~ s/x3B/;/g;     &UpdateCookie("write", $username, ${$uid.$username}{'password'}, ${$uid.$username}{'session'}, "/", $ck{'len'}); 
       $tmpredir =~ s/search2/search/g;    
       $redir = qq~?$tmpredir~;     $redir = ""; 
   }     if($FORM{'sredir'}) { 
   $yySetLocation = qq~$scripturl$redir~;         my $tmpredir = $FORM{'sredir'}; 
   &redirectexit;         $tmpredir =~ s/\~/\=/g; 
         $tmpredir =~ s/x3B/;/g;  
         $tmpredir =~ s/search2/search/g;  
         $redir = qq~?$tmpredir~;  
     }  
     $yySetLocation = qq~$scripturl$redir~;  
     &redirectexit;  
} }
   
1; 1;