Building an E-Commerce Site Part 2: Managing Users with Sessions - Step 5: User Scripts
(Page 8 of 10 )
In the users directory, we keep a bunch of scripts to let users manage themselves (to some extent):
users/signup.php This script lets a user signup for an account. Signing up for an account is a straight forward process. The user fills in their information, and selects a username and password. Note that in our validation function, we check to see that the user fills in all the required fields, and also that the username and email addresses do not already exist. If they do, the user will have to specify different ones.
users/forgot_password.php The forgot password script asks the user for their email address and then looks up their user record in the database. If a user record is found, the user's password gets reset to some random word and then their new password address gets sent to their email address. This is why it is important that there are no duplicate email addresses on the system.
users/change_password.php A simple script to let the user change their password.
users/change_password.php A simple script to let the user change their settings. Note, we can't have the user changing their username (that's a big no-no!), firstname, or lastname.
Next: Step 6: A Note on Security >>
More PHP Articles
More By Ying Zhang