我正在尝试登录并设置会话 id。下面的代码没有成功验证登录,也没有设置会话 id。请帮忙。
public $userid;
function login()
{
$pwdHasher = new PasswordHash(8, FALSE);
if(isset($_POST['logging']) AND !empty($_POST['logging'])){
$email=mysqli_real_escape_string($this->db->connection ,$_POST['email']);
$pass=mysqli_real_escape_string($this->db->connection ,$_POST['pass']);
$sql=mysqli_query($this->db->connection,"SELECT * FROM user where email='$email' AND password='$pass'");
$numrows=mysqli_num_rows($sql);
$resid=mysqli_fetch_array($sql);
$checked = $pwdHasher->CheckPassword($pass,$numrows);
if($checked){
$this->userid=$_SESSION['id']=$resid['id'];
$this->login=TRUE;
echo "u r logedin.Plz click here to go to main area<a href='main.php'>main</a>";
}
else{
echo "username r password is wrong";
$this->login=FALSE;
}
}
}