Login Systems due Mon 12 Feb 11:00

In completing this assignment you will:
...\item Utilize session variables to protect a page.


At the end of this assignment your book selling application should have the following pages:
Same as was developed in lab day assignment.

This page presents a login form (self-posting). The login form behavior should be as follows:
  • If login fails for any reason the form should be re-displayed with an error message ``Attempt to Login Failed''. This is a rare situation where we don't want to be especially helpful!
  • Reasons login might fail include no matching email address found in the database and provided password not matching value stored in database.
  • When checking their password you'll pull their password from the database and use password_verify to see if their typed password matches the hashed password stored in the database. Recommended query:
    SELECT owner_id,password FROM yourschemaname.owner WHERE email=$1
  • If the above query is not empty and the password matches then it is time to set a session variable. I recommend setting a session variable to hold the owner_id because that will identify who is logged in.

Same as in previous assignment except that it now requires a user to be logged in. If no user has been logged in then a visit to this page should be redirected to login.php using PHP's header command. Also, instead of always assigning a new listing to have an owner_id of 1, you will assign the id value based on the value stored in the session variable.

NOTE: To test, you'll need to have multiple accounts created and log in as various users. For this reason you'll want a logout script that will delete the session variable and then redirect to the login screen.

Same as in previous assignment.

Quick Links