pranshu82202 Posted August 19, 2011 Share Posted August 19, 2011 I have created a registration form for my website. I want that, whenever any user register to my website an automated mail is send to the Email (with an confirmation link of registration) which he had given their.... I am able to send mails via smtp but dont know how to create a confirmation link url... :confused: :confused: I thought so that it must be the cookie which automatically generated on the registration.. I need your help.. Thanx in advance... Quote Link to comment https://forums.phpfreaks.com/topic/245229-confirmation-url/ Share on other sites More sharing options...
Psycho Posted August 19, 2011 Share Posted August 19, 2011 When a user registers you can just generate a unique code for that user, store it in the database and then send the user an email with a url using that unique code as a parameter of the url. Here is an outline of the steps you could take: 1. User registers on your site. 2. Create a "random" code. For example you could create an MD5 hash of their username and/or email address. Just make sure it will be unique 3. Store that value in a column in the user table (e.g. registration code). 4. Create a url (e.g. www.mysite.com/confirm.php?code=[random_code]) with that code as a parameter and send it to the user in an email 5. Create a page for that URL to point to (confrm.php). In that page grab the code using $_GET and do a MySQL query(ies) to update that user record to be "confirmed" You also need to determine how to differentiate between confirmed/unconfirmed users. One easy method is to simply remove the confirmation code when the user confirms their account. Then if a user attempts to log in after checking the username/password you would check to see if there was a value for the confirmation code. If so, you provide a message that they need to confirm their account before logging in. Although, you would need to consider if you need to provide a means for someone to regenerate the confirmation email. Or even change the email if they mistyped it. Quote Link to comment https://forums.phpfreaks.com/topic/245229-confirmation-url/#findComment-1259586 Share on other sites More sharing options...
pranshu82202 Posted August 20, 2011 Author Share Posted August 20, 2011 Hey mjdamato, It cleared all my doubts regarding confirmation url. Thnks for your kind help... [email protected] Quote Link to comment https://forums.phpfreaks.com/topic/245229-confirmation-url/#findComment-1259672 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.