avvllvva Posted August 2, 2009 Share Posted August 2, 2009 what are the better ways to do the module -- Send an activation link email after a user registration. And after the activation, that link to be expired for ever ?? using php , mysql. Quote Link to comment https://forums.phpfreaks.com/topic/168479-how-to-create-an-activation-link-email/ Share on other sites More sharing options...
gizmola Posted August 2, 2009 Share Posted August 2, 2009 The simplest way is to have an activation table. You create a row on activation, and this table has the userid, created, activationcode and activated, which can be a tinyint you default to 0. Usually the code itself will be a hash value -- md5 or sha1 typcially. You can use the useremail+date+userid+salt to get a good input value for our validation script. When the validation script is called it should only accept the single get param of the activationcode. In the script simply look up the row in the activation script. You have these possiblities: -Not found (error) -Found (Already activated) (expired) -Found (unactivated) -- Do account activation, update and set 'activated' = 1. You can also use the created flag to limit the use of old activation codes -- for example, you might check to make sure that the activation is within 48 hours and choose to disallow activation on that basis. Quote Link to comment https://forums.phpfreaks.com/topic/168479-how-to-create-an-activation-link-email/#findComment-888731 Share on other sites More sharing options...
Daniel0 Posted August 2, 2009 Share Posted August 2, 2009 I'd put the activated field in the users table though. Otherwise you would have to check the activation email all the time. Quote Link to comment https://forums.phpfreaks.com/topic/168479-how-to-create-an-activation-link-email/#findComment-888742 Share on other sites More sharing options...
Third_Degree Posted August 2, 2009 Share Posted August 2, 2009 yeah, fastest way I'd say is just to have an activation field in the users table. Fill it with a random code that will be verified via two GET variables (id and code) sent in an email, and then change the field to "y" or 1, or something. Then on the activation page, if anyone ever passes the same id variable with the activation field equalling "y" or 1, shoot them a header with an expired date. Quote Link to comment https://forums.phpfreaks.com/topic/168479-how-to-create-an-activation-link-email/#findComment-888744 Share on other sites More sharing options...
shadiadiph Posted August 2, 2009 Share Posted August 2, 2009 tha is how i do it an active column they can be yes or no or y n if they clcik on the link twice creat a message if active=="yes" { echo "You have already activated your account"; } remember to include a deactivation link also Quote Link to comment https://forums.phpfreaks.com/topic/168479-how-to-create-an-activation-link-email/#findComment-888863 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.