我正在开发一个旧网站广告,登录功能永远需要。我试图深入了解这只是我不确定是什么原因造成的。
登录功能使用 AJAX。
AJAX
$password = md5($_POST['thepassword']);
$user = $_POST['theusername'];
$loginVar = $usersClass->login($user, $password);
if(is_array($loginVar))
{
$_SESSION['loggedIn'] = $loginVar;
@session_regenerate_id(true);
print "success";
}else{
print "Whoops, something went wrong! Try again.";
}
PHP 类
public function login($username, $password)
{
$rs = mysql_query("SELECT `id`,`active` from `$this->usersTable` WHERE
`username` = '".mysql_real_escape_string($username)."' AND
`password` = '".mysql_real_escape_string($password)."'");
if($rs) {
$row = @mysql_fetch_object($rs);
return $this->userInfo($row->id);
}else{
return false;
}
}