Hello,
No problem with password reset,
What I want to do is,
I want to limit the reset code to send 3 times in an hour
How is this done?
Thank you
Hello,
No problem with password reset,
What I want to do is,
I want to limit the reset code to send 3 times in an hour
How is this done?
Thank you
Check when it was last sent and if it violates any business rules, don’t send it.
Time to send password reset code
MySQL
Column
reset_time: 1579895283
how_many_times_sent_code: 3
$time = time();
$resettime = $reset_time + 3600;
//How should I write here a condition?
if($how_many_times_sent_code < 4 && $reset_time < $resettime ){
//Reset code, send code
//No problem here
}else{
echo "You can send a password reset code up to 3 times in an hour";
}
First you need to query the database to get the info. How is the table structured?
SELECT
COUNT(id)
FROM
table
WHERE
user_id = ?
and
date_added
BETWEEN
now()
and
date_sub(date_added,interval 1 hours)
If the count is greater that 3 you know they exceeded 3 requests in the last 60 minutes.
Thank you for your help
However, the code system you provide is difficult for novices like us.
I fixed the problem with the if() condition
We are novice