Re: registration form with activation code sent to user
| From: | -{ Rene Brehmer }- | Date: | Sun, 19 Jun 2005 23:26:34 +0000 |
| Subject: | Re: registration form with activation code sent to user | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-39705@lists.php.net to get a copy of this message | ||
Documented research indicate that on Thu, 16 Jun 2005 16:20:31 +0100 (BST),
babu wrote:
> Ya joseph u r right, i am thinking of the url to be generated to be send to the user.
> I followed u r steps but did not understand some points.
>
>>>2.) Store that string to the database somewhere
> where to store in database, i mean when the user clicks the activation code how to
> check the users identity.?
I actually made this exact functionality for one of my projects a few weeks
ago. I made a seperate table simply called 'confirm', that contains the
userID for the user in question, the confirmationcode to match, and the
expiration time for this confirmationcode, plus an auto-incremented index
column.
In the users table I then simply have a boolean field called 'confirmed',
that's set to 0 (false) by default. When a user's email address have been
confirmed, this field is changed to 1 (true).
The only reason I have expiration time in this table is for cleanup
purposes.
>>>3.) Email the mail to the address specified with the url to the confirm page
> one must send the email manually or is there any automatic generator for email sending to
> users.?
Read up on the mail() function. It's actually pretty simple.
All you have to do is send an email, with some proper explanatory text,
with a link to your confirm.php script (or what you choose to call it),
either with a direct link with a get statement including the confirmation
code, or with a link to the confirmation script, and then the confirmation
code and instructions on how to enter it. Or at best: offer both options.
Then simply have your user registration/signup code send the email whenever
a user registers.
>>>this will confirm that they did in fact check thier email.
> how exactly, can explain little bit.?
Make the code generate a unique confirmation code (this is pretty simple),
and then just have your confirmation script compare the confirmation code
with the one in the database. If there's a match then the user to whom you
sent that particular code is confirmed.
All of the code needed to do this is actually fairly simple to write.
Rene