Ich habe versucht, einige Fallen zu setzen, aber es hat nicht funktioniert. Ich kann mich mit falschem Benutzernamen und Passwort einloggen. Was ist die mögliche Lösung dafür?Benutzername und Passwort Fehlerbehandlung
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();
} ?>
Wie Sie '$ result' bekommt, können Sie Ihre DB-Abfrage erstellen. –
$ stmt = $ conn-> prepare ("SELECT account.acc_username, account.acc_password, tables.table_id FROM account INNER JOIN-Tabellen ON Tabellen.table_id = account.table_id WHERE tables.table_number = '$ makerValue' AND account.acc_username = '$ uname' UND account.acc_password = '$ pword' "); $ stmt-> execute(); $ result = $ stmt-> fetchAll (PDO :: FETCH_ASSOC); –