how to expire an activation link with php

hi i am currently working with php which requires registration once the user registers with his/or her details then an email is sent to the user for activation once the link is clicked the account is activated this works perfectly but the question is how do i expire the link after 24hrs. there is a regdatetime in the members table the this is a time timestamp (current time stamp)…i know the algorithm but i dont know how to code it please help…

You can do it a number of ways…

  1. You can run a cron job every minute that that expires the link after 24 hours has passed
  2. When a user clicks the link after 24 hours, you can expire it and display a message to the user that the time has expired for the current link that was clicked.

No one can show you how to code it, or change your current code to do what you want, if we don’t have anything to work with.

I have other idea’s but to start with,

What information are you sending in the link?

Typically when I create something like this I use an ‘email code’ which is basically an encrypted timestamp. If you were to send out an encoded timestamp or something as simple, yet not secure, as a datatime stamp on the end of the url string, you could substring that to do the time calculations on.

Sponsor our Newsletter | Privacy Policy | Terms of Service