私の問題は、x回のログイン失敗に対してカウンターを機能させることです。MySQL の私の列は次のとおりです: ID、ユーザー名、パスワード、試行 & アドレス!
if ($result[0]['total'] == true)
{
$_SESSION['userLogin'] = $result[0]['total'];
$_SESSION['isLoggedIn'] = $login;
header('location: index.php?id=home');
$db->query("UPDATE authenticate SET attempts=0, adress='$ip' WHERE username='$login'");
exit;
}
else
{
$rs = mysql_query('SELECT id,username,password,attempts,address FROM authenticate WHERE username = '.$username.'');
$num = mysql_num_rows($rs);
if ($row['attempts'] > 3) {
// Redirect to captcha
header('location: captcha.php');
} else {
$ip = $_SERVER['REMOTE_ADDR'];
if ($row['address'] != $ip) {
// New ip adress, reset failed logins
$failed_logins = 0;
} else {
// Increment failed logins
$failed_logins = $row['attempts']+1;
}
mysql_query('UPDATE authenticate SET attempts = '.$failed_logins.',address = '.$ip.' WHERE id = '.$row['id'].' ');
}
header('location: index.php');
exit;
}