";
elseif(strlen($loginuser) > 20) $error = "Maximum username length is 20 characters.
";
elseif(strlen($loginpass) < 6) $error = "Minimum password length is 6 characters.
";
elseif(strlen($loginpass) > 20) $error = "Maximum password length is 20 characters.
";
else {
// run downgrades
include_once("downgrade-checker.php");
// check username
$check_user = mysql_query("SELECT id, emailadd, status, cookiekey, isadmin FROM users WHERE username = '".preparedata($loginuser)."' AND password = MD5('".preparedata($loginpass)."') AND status != 'suspended' LIMIT 1");
if(mysql_numrows($check_user) > 0) {
// log in user
$_SESSION[sess_loggedin] = TRUE;
$_SESSION[sess_username] = $loginuser;
$_SESSION[sess_userid] = mysql_result($check_user, 0, id);
$_SESSION[sess_emailadd] = mysql_result($check_user, 0, emailadd);
$_SESSION[sess_memtype] = mysql_result($check_user, 0, status);
$_SESSION[sess_isadmin] = mysql_result($check_user, 0, isadmin);
$cookiekey = mysql_result($check_user, 0, cookiekey);
setcookie("cookname", $loginuser, time()+60*60*24*100, "/");
setcookie("cookkey", $cookiekey, time()+60*60*24*100, "/");
// update lastlogin details
$userip = GetHostByName($REMOTE_ADDR);
$update_login = mysql_query("UPDATE users SET lastlogindate = NOW(), lastloginip = '".$userip."' WHERE id = ".$_SESSION[sess_userid]." LIMIT 1");
if($_SESSION[sess_isadmin] == 'yes') header('Location: admin-home.html');
else header('Location: members-home.html');
die();
exit;
}
else $error = "Your username and password did not match an account on our system, please try again.
";
}
}
include("header.php");
?>
Login to your Account: Use the form below to login to your account. To register for an account click here. 0) echo show_error($error)." "; ?> |