Jump to content

How to create an activation link email ?


avvllvva

Recommended Posts

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.

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.