Log in

View Full Version : E-mail confirmation link PHP



Jaysun
22-02-2009, 07:14 PM
I'm trying to advance the PHP skills I have now and make a user system with some more features. I'm stuck on how to create the user-system so that the user gets an email with a confirmation link in which they have to click then they would be verified and be able to use the site.

wsg14
22-02-2009, 07:29 PM
I coded exactly that a few days ago, it's pretty simple. Add two fields to your user table, (activationkey and activated) upon registration make a variable that creates a random number code and insert it into the actvationkey column. Then set activated to no. Then have an email be sent to the user's email with a link something like this "http://www.yoursite.com/activate.php?key=$activationkey" $activationkey being the variable that holds their key number.

Then make account.php which uses an if statement to see if the user's account is activated, if it isn't then update the activated column to yes where activationkey = $_GET['activationkey'].

If you get my drift, ask me on msn/twitter of you need any more help as this is sort of a brief description.

Protege
22-02-2009, 07:51 PM
Or you could just have "Activation" and set a code, if confirmed set it with "true"

Meti
22-02-2009, 08:32 PM
http://phpeasystep.com/phptu/24.html

Should work.

Jaysun
22-02-2009, 08:43 PM
Thank you. +Rep

Dentafrice
22-02-2009, 08:50 PM
If that doesn't work..

Just have two fields, activation_code & activated (default, 0).

E-mail them with the activation code, which links to a file on your site, it checks it.. then sets activated to 1.

Easy ;)

Want to hide these adverts? Register an account for free!