everurssantosh Posted September 20, 2008 Share Posted September 20, 2008 Hi, I am trying to create an Authorization code for a user which should automaticaly get expired after 15 mins of generation. I am using PHP rand function to generate the code. This code will be sent to user by mail. Now, user must use the code with in 15 mins in some other page. The problem : how to I delete the code after 15 mins, though I save the time of generation of the code. Please help me in this regard Santosh Quote Link to comment Share on other sites More sharing options...
DyslexicDog Posted September 20, 2008 Share Posted September 20, 2008 If you're using a database you should set a creation time when you set the random number. Just check the creation time against the access time if it's been more than 15min then deny access, and delete the record. Quote Link to comment Share on other sites More sharing options...
ratcateme Posted September 20, 2008 Share Posted September 20, 2008 if you save a timestamp with the code then when the user checks the code check the timestamp if after 15mins say invalid and delete it Scott. Quote Link to comment Share on other sites More sharing options...
everurssantosh Posted September 20, 2008 Author Share Posted September 20, 2008 Hi Thank you for the reply... But I dont want to keep the access code in database after 15 mins. I want to delete the access code after 15 mins... and the code will be generated again when the user requests for the code. I am using PHP and MYSQL.. can I use triggers??? or anything in PHP?? Thanks Santosh Quote Link to comment Share on other sites More sharing options...
ratcateme Posted September 20, 2008 Share Posted September 20, 2008 you could set a cron job to go every 15mins and check for old codes and delete them Scott. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.