if(isset($_SESSION['username']) && isset($_SESSION['password'])){
header("Location: ../welcome/index.php");
我的登录脚本最近似乎停止工作了,7 月 19 日 PHP 的新更新。
任何人都可以解决这个问题吗?
这是整个脚本。
<?
include_once ('includes.inc.php');
if (!isset($_POST['login']) || (strlen($_POST['username']) < 3) || (strlen($_POST['password']) < 3)) { //User forgot a field
header("Location: ../index.php?message=4");
}
else {
$username = htmlspecialchars(mysql_real_escape_string(trim($_POST['username'])), ENT_QUOTES);
$password = sha1(trim($_POST['password']));
$sqlPass = mysql_query("SELECT isbanned, password, id FROM members WHERE username = '" . $username . "'");
$sqlPass = mysql_fetch_array($sqlPass);
if (($sqlPass['password'] == NULL) || ($sqlPass['password'] != $password)) { //User entered wrong information
header("Location: ../index.php?message=5");
}
else if ($sqlPass['isbanned'] == '1') {
header("Location: ../index.php?message=50");
}
else {
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;
$_SESSION['uid'] = $sqlPass['id'];
//Log IP
AddIPToLogs();
if (isset($_SESSION['username']) && isset($_SESSION['password'])) {
header("Location: ../welcome/index.php");
}
}
}
?>