Jump to content

Confirmation URL


pranshu82202

Recommended Posts

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: :confused: :confused: :confused:

 

I thought so that it must be the cookie which automatically generated on the registration.. :wtf:

 

I need your help..

 

Thanx in advance...

Link to comment
https://forums.phpfreaks.com/topic/245229-confirmation-url/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/245229-confirmation-url/#findComment-1259586
Share on other sites

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.