I am writing a login system in PHP and would like a to implement a function that checks if the 15 minutes has elapsed since the last failed login attempt.
In the MySQL database in my users table there is a column called last_login_datetime which is defined as SQL's DATETIME format, ex. 2018-02-24 21:12:57.
This is the code I am using to check if 15 minutes has elapsed since the last login fail
$dateTime = date("Y-m-d H:i:s");
if($row['user_locked']==$statusY AND $dateTime - strtotime($row['last_loginfail_datetime'] > 15 * 60))
{
.....
}
This does not seem to work for me at the moment and was hoping if someone could point out where I am going wrong?
Thanks in advance.