为什么这段代码不起作用?
它总是进入 else 并设置 $_SESSION['wronglogin']=1; 它是一个登录脚本,它接受电子邮件 ID 和密码的输入,然后检查是否存在任何此类内容,那么它应该启动 $_SESSION['loggedin'],否则启动 $_SESSION['wronglogin']。我已经尝试了很多,但我就是不明白
$_SESSION['login-id']=$loginid;
$_SESSION['loginpassword']=$loginpassword;
$loginid = stripslashes($loginid);
$loginpassword = stripslashes($loginpassword);
$loginid = mysql_real_escape_string($loginid);
$loginpassword = mysql_real_escape_string($loginpassword);
$con = mysql_connect("localhost", "moodabsz_naman", "database") or die(mysql_error());
mysql_select_db("moodabsz_database",$con) or die(mysql_error());
$sql="SELECT *
FROM user
WHERE `email_id` = '$loginid'
AND `password` = '$loginpassword'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count==1){
$_SESSION['loggedin']=1;
mysql_close($con);
header('location: index.php');
}
else {
$_SESSION['wronglogin']=1;
echo "Wrong Username or Password";
mysql_close($con);
header('Location: index.php');
}