Reputation: 19
i need to make activation code for my users. When users are registered, my php script would send an email to users and i dont know how to implement activation code or activation link. I dont know logic for this
Upvotes: 1
Views: 8557
Reputation: 1253
You can also use a table-less solution to generate one-time passwords. Have a look at http://bakery.cakephp.org/articles/ashevat/2010/03/12/how-to-implament-one-time-password-for-forgot-my-password-and-account-activation-processes
Upvotes: 0
Reputation: 731
Or you could simply use CakeDC's users plugin and avoid all that trouble.
Upvotes: 0
Reputation: 30252
$user_rand
;users
table in activation_secret
column, set the active
column to 0http://host.com/activate.php?activation_code=sfer3423ste&username=john
activatate.php
extract the username
and the activation code
(which is the hash you sent)users
table for a record which has active=0
and user=john,
return the value in activation_secrete
activation_secrete
and compare the hash with activation code
from the url, if they match, the user should be validated (set active
column to 1) if not, inform the user the activation code is not recognized.You can build on this and make it robust and add exception handling. E.g. you can also set a life time for the activation secrete and more.
Upvotes: 8
Reputation: 32946
I've not done it but I would have thought that it would be along the lines of:
Upvotes: 1
Reputation: 28926
This is a four-step process:
For an example implementation, please see:
http://www.learnphponline.com/scripts/email-activation-for-php-forms
Upvotes: 11