mysql_connect("AHOST", "MYDATABASE", "PRIVACY");
mysql_select_db("u848966676_users");
$email = $_POST['email'];
$password = $_POST['code'];
$rs = mysql_query("SELECT * from `users` WHERE `email`='$email' LIMIT 1");
if(!$rs) die(mysql_error());
if(mysql_num_rows($rs) > 0) {
$active = 0;
while ($row=mysql_fetch_row($rs)) {
$rp = $row['password'];
$active = $row['active'];
if($password != $rp) {
die("<script>alert(\"Password is incorrect.$rp and $password\");</script>");
}
}
if($active === 0) {
echo "<script>alert(\"Account has not been verified.\");</script>";
} else {
$_SESSION['logged'] = true;
$_SESSION['email'] = $email;
header("Location: index.php");
}
} else {
echo "<script>alert(\"Account does not exist.\");</script>";
}
而我的问题是$ rp是&#34;&#34; ......它真的是空的! 但在phpMyAdmin上显示我的密码... :(
答案 0 :(得分:0)
mysql_fetch_row返回一个数值数组,所以你应该使用mysql_fetch_assoc作为一个assoziative数组。
不推荐使用mysql_扩展名,将来会删除它,如果你以后不想改变所有内容,你应该使用mysqli_或(更好)PDO。