meltingpoint Posted September 16, 2010 Share Posted September 16, 2010 Problem; Need to check to see if someone who requested a password re-set has done so with in 24hrs. IF not- then it needs to prompt them to re-submit the request and deletes the previous re-submit code sent to them in their email. I have everything else figured out (deleting re-set code) but I have not figured the checking of if they have done so within the 24hr time period. Please tell me if the code below will accurately tell me if they complied with the 24 hour rule. $time1 = '1284675867';// logged at the time of password re-set request. Retrieved from database $time2 = time();// captured in script when they actually re-set their password $difference_between = $time2 - $time1; if($difference_between >= '5,200,000') { echo "Sorry- you have exceeded the 24 hr rule and need to re-submit your request"; } Compared to all that I have seen.........it appears rather simplistic. Am I missing something or will this simple approach work? Link to comment https://forums.phpfreaks.com/topic/213616-difference-in-time-mainly-if-over-24-hrs/ Share on other sites More sharing options...
schilly Posted September 16, 2010 Share Posted September 16, 2010 Looks fine but you're dealing with ints so you need to remove the quotes. Also where did you get 5200000 from? There's 86400 (60*60*24) seconds in a day. Link to comment https://forums.phpfreaks.com/topic/213616-difference-in-time-mainly-if-over-24-hrs/#findComment-1111886 Share on other sites More sharing options...
meltingpoint Posted September 17, 2010 Author Share Posted September 17, 2010 Yeah- I was sitting back looking at it and saw I butchered the math. Thanks for the reply and advise. Cheers- Link to comment https://forums.phpfreaks.com/topic/213616-difference-in-time-mainly-if-over-24-hrs/#findComment-1111917 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.