1
我試着用電子郵件確認做一個登錄系統,所以當用戶確認電子郵件時,數據庫中的哈希值從MD5值變爲「確認」,然後在logon.php我用:
if (isset($_POST['submit']))
{
$confirmed = 'confirmed';
$username = $_POST['username'];
$password = $_POST['password'];
$query = "SELECT id, username FROM users WHERE username = ? AND hash = ? AND password = SHA(?) LIMIT 1";
$statement = $databaseConnection->prepare($query);
$statement->bind_param('sss', $username, $password, $confirmed);
$statement->execute();
$statement->store_result();
if ($statement->num_rows == 1)
{
$statement->bind_result($_SESSION['userid'], $_SESSION['username']);
$statement->fetch();
header ("Location: index.php");
}
else
{
echo "Username/password combination is incorrect.";
}
}
我已經嘗試了一切,但$statement->num_rows
總是返回0,任何人都可以幫助我嗎?請
作爲預留不,把你的'header'重定向行之後的'exit' –