|
Posted by J.O. Aho on 01/19/06 21:06
Bert Bos wrote:
> Hi,
>
> when users are register on our website, their username, encrpyted
> password and so on are stored in the mySQL database.
>
> Many phpbb sites though send an activation mail to the email address
> specified by the user. The user then needs to select a link to get his
> account activated.
>
> I would like to implement this process, can anyone tell me how this is
> done?
It's quite easy IMHO, you will need one extra php page. Here is an idea for a
simple one
You will need to add one more column in the user table, (SQL: ALTER), lets
call this new column for user_activated, we want to be able to store a hashed
string here, so we need to make it to take some space, say 32 characters.
When the user register and your current script is to save data, generate the
random hashed string (PHP: md5(time())), when data saved to sql, use mail()
and send the the hashed string to the user, eg
http://www.example.net/activate.php?c=35urwefhsdf4t6ioy
The activate.php will see if there is a hashed string that is the same as the
one that the visitor used in the database, then modify the hashed string for
that user to say ACTIVATED.
In your login script page you will need to add a check where a check against
the user_activated column has the string ACTIVATED, to allow the user to login.
//Aho
[Back to original message]
|