Yellow Jacket
Blue Ridge High School
Yellow Jacket
Home > Web Design > Web II > Add Users

Add Users

Objectives


Tasks

  1. Create a new PHP file called "adduser.php".
    • Create a form that asks for an email (use an email input) and password (use a password input).
    • Bonus challenge: Require the password to be entered twice and verify that the passwords match.
  2. If not already completed, create a table called "users" in your MySQL database.
    • You should have the following fields:
      • id - set type as "TINYINT", make primary key, auto increment
      • email - set type as "VARCHAR" with length 40
      • password - set type as "VARCHAR" with length 20
  3. Create a new file called "storeuser.php".
    • Hash the submitted password using the crypt() function
      • Create your own random salt, such as $salt="somerandomtext1234"
      • Usage: $hash=crypt($password, $salt)
        • The "hash" is the encrypted password that uses the salt.
      • Bonus challenge: Use the crypt() function to create the salt and store the salt in the "users" table
    • Insert the submitted email and hashed password into the "users" table.
      • You will need to include the connect file to establish a connection to your database.
      • Bonus challenge: Use PDO to store the information.....it is the most secure method.
    • Display a message stating "The user was successfully added." when the user information is successfully inserted into the database
    • Provide the user the option to add another user
      • Can insert a link that returns to the adduser.php page .
  4. Create a link to the add user page on your main index page.
    • You can use the "Login" link for the time being.
      • Other links to include would be "Edit Page" from your previous assignment.
  5. Use your existing company layout for the pages you create. This should be easy if you created a separate header and footer file.
  6. Validate your form and display page.