###############################################################################
# LogInOut.pl #
###############################################################################
# YaBB: Yet another Bulletin Board #
# Open-Source Project started by Zef Hemel (zef@zefnet.com) #
# Software Version: YaBB 1 Gold - Release #
# =========================================================================== #
# Software Distributed by: http://yabb.xnull.com #
# Support, News, Updates at: http://yabb.xnull.com/community/ #
# =========================================================================== #
# Copyright (c) 2000-2001 X-Null - All Rights Reserved #
# Software by: The YaBB Development Team #
###############################################################################
$loginoutplver="1 Gold - Release";
sub Login {
$yytitle = "$txt{'34'}";
&header;
print <<"EOT";
EOT
&footer;
exit;
}
sub Login2 {
&fatal_error("$txt{'37'}") if($FORM{'username'} eq "");
&fatal_error("$txt{'38'}") if($FORM{'passwrd'} eq "");
$FORM{'username'} =~ s/\s/_/g;
$username = $FORM{'username'};
&fatal_error("$txt{'240'}") if($username !~ /^[\s0-9A-Za-z#%+,-\.:=?@^_]+$/);
&fatal_error("$txt{'337'}") if($FORM{'cookielength'} !~ /^[0-9]+$/);
if(-e("$memberdir/$username.dat")) {
fopen(FILE, "$memberdir/$username.dat");
@settings = ;
fclose(FILE);
$settings[0] =~ s/[\n\r]//g;
if($settings[0] ne "$FORM{'passwrd'}") { $username = "Guest"; &fatal_error("$txt{'39'}"); }
$settings[0] = "$settings[0]\n";
}
else { $username = "Guest"; &fatal_error("$txt{'40'}"); }
if($FORM{'cookielength'} < 1 || $FORM{'cookielength'} > 9999) { $FORM{'cookielength'} = $Cookie_Length; }
if($FORM{'cookieneverexp'} ne 'on') {
$Cookie_Length = $FORM{'cookielength'};
&SetCookieExp;
}
else { $Cookie_Exp_Date = 'Sun, 17-Jan-2038 00:00:00 GMT'; }
$password = crypt("$FORM{'passwrd'}",$pwseed);
$yySetCookies = qq~Set-Cookie: $cookieusername=$username; path=/; expires=$Cookie_Exp_Date;\n~;
$yySetCookies .= qq~Set-Cookie: $cookiepassword=$password; path=/; expires=$Cookie_Exp_Date;\n~;
&LoadUserSettings;
&WriteLog;
&redirectinternal;
}
sub Logout {
# Write log
fopen(LOG, "$vardir/log.txt");
@entries = ;
fclose(LOG);
fopen(LOG, ">$vardir/log.txt", 1);
$field="$username";
foreach $curentry (@entries) {
$curentry =~ s/\n//g;
($name, $value) = split(/\|/, $curentry);
if($name ne "$field") {
print LOG "$curentry\n";
}
}
fclose(LOG);
$yySetCookies = qq~Set-Cookie: $cookieusername=; expires=Thu, 01-Jan-1970 00:00:00 GMT;\n~;
$yySetCookies .= qq~Set-Cookie: $cookiepassword=; expires=Thu, 01-Jan-1970 00:00:00 GMT;\n~;
$yySetCookies .= qq~Set-Cookie: $cookieusername=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT;\n~;
$yySetCookies .= qq~Set-Cookie: $cookiepassword=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT;\n~;
$username = 'Guest';
$password = '';
@settings = ();
$realname = '';
$realemail = '';
$ENV{'HTTP_COOKIE'} = '';
&redirectinternal;
}
1;