I made an Email Verification Link where the link will valid for only the next 10 minutes from the time of mail sent but my code as given below is not works.
Wait, I show all the related threads on StackOverflow and offcourse I got the same question-related post but I also do that result answer but it not works for me, so that I posted this question might somebody have the same issue and it will help to others.
Please do not marks it as duplicate and under review mode, and try to understand my query.
Please help me how I fix this issue and what would be correct code. :(
MY Code is Below : -
Other Code
date_default_timezone_set('Asia/Kolkata');
tokenExpire formats: (new DateTime('+10 minutes'))->format('Y-m-d H:i:s')
DB Structure[name as signup]
-----------------------------------------------------
Email | token | tokenExpire |
----------------------------------------------------
abcd@domain.com | {randNum} | 2019-10-19 09:42:10 |
-----------------------------------------------------
PDO Statement
$sql = $con->prepare("SELECT `Email`,`token` FROM `signup` WHERE Email= :1 AND token= :2 AND tokenExpire > NOW()");
$sql->execute(array(
':1' => $emailid,
':2' => $tokenum
));
if ($sql->rowCount() > 0) { echo "Link Is Valid"; }
else { echo "Link Expired"; }
I expects it must show time expire or valid info behalf of my code but it not works, and show Link valid even the time has past.