I'm trying to check attempted logins by the user has committed. For some reason it skips even tough I have 7 entries in my database, +1 of reach try, with similar IP and user_id
.
This is my query, full code can be found here.
// BRUTE FORCE CHECK
$remote_ip = $_SERVER['REMOTE_ADDR'];
$sql = "
SELECT attempt_nr
FROM users_login_attempts
WHERE user_id = :userid
AND time > NOW() - INTERVAL 1 HOUR
AND user_ip = :userip
";
$results = $db_connect->prepare($sql);
if ($results->execute(array(':userid' => $user_id,':userip' => $remote_ip))){
$count_tries = $results->rowCount();
if ($count_tries < 5) {
// DO SOMETHING IF LIMIT IS NOT REACHED
}
else {
// RETURN FAILURE
}
How come the user skips this part?
IMAGES: TABLE STRUCTURE
TABLE
MY CODE
THE VAR_DUMP RESULT