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.

 

 

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.