Mutley Posted January 20, 2007 Share Posted January 20, 2007 How do you do confirmation e-mails, for example, if somebody registerd to my site it e-mails them a generated link that activates their account when visited?Thanks. Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 20, 2007 Share Posted January 20, 2007 php.net/mail Quote Link to comment Share on other sites More sharing options...
.josh Posted January 20, 2007 Share Posted January 20, 2007 you would - make a field in the user's table called "active" or some other such thing and set it to 0 by default.- make a seperate table called "activationCodes" with fields "code" and "userId" - in your registration processing script (the part that inserts the user's info into the db), generate a random alpha-numeric string. Lots of methods out there. - Insert the user's id and the code into activationCodes. - mail the code to the user. see jesirose's post, as far as mailing. - make a script where the user can enter in the code. Your script will then change the user's "active" to 1, where the user's id matches the userid associated with the code in the activationCodes table. A lot of people like to make this script accept the code through the url, and then send a link to the page with the code passed through the url, for the user's convenience. The email would then look something like this:[code]hello user, your code is: lksdf23lkj0d903kd you can click on this link here to get activated:http://www.yoursite.com/activate.php?code=lksdf23lkj0d903kdif for some reason the link is broken or otherwise mangled, just go and manually enter it in, etc.. blahblahblah.the end.[/code] Quote Link to comment 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.