我試圖把一些陷阱,但它沒有奏效。我可以用錯誤的用戶名和密碼登錄。這有什麼可能的解決方案?用戶名和密碼錯誤處理
foreach ($result as $row) {
$acc_username=$row['acc_username'];
$acc_password=$row['acc_password'];
$acc_tableid=$row['table_id'];
}
if ($result == 0){
echo '
<div class="alert alert-danger">
<strong>Danger!</strong> This alert box could indicate a dangerous or potentially negative action.
</div>';
echo ("<SCRIPT LANGUAGE='JavaScript'>
window.location.href='tableLogin.php';
</SCRIPT>");
}
else{
$_SESSION['table_number'] = $_POST['Make'];
$_SESSION['table_idd'] = $row['table_id'];
header("Location: customerLogin.php");
}
$update = "UPDATE tables SET login_status=1 WHERE table_id= $table_id";
if(mysql_query($update)){
}
}catch(PDOException $e) {
echo "Connection failed: " . $e->getMessage();
} ?>
你怎麼'$ result',你可以發表你的數據庫查詢了。 –
$ stmt = $ conn-> prepare(「SELECT account.acc_username,account.acc_password,tables.table_id FROM account INNER JOIN tables ON tables.table_id = account.table_id WHERE tables.table_number ='$ makerValue'AND account.acc_username = '$ uname'AND account.acc_password ='$ pword'「); $ stmt-> execute(); $ result = $ stmt-> fetchAll(PDO :: FETCH_ASSOC); –