MMDT1146 PHP Programming
Week 8


Week 8

Notes:

  • There are 4 ways to pass data around from page to page.
  • $_GET[ ]  which is seen in the URL and usually comes from a form using a get method.
  • $_POST[ ]  which is passed from a posted form, and is not seen in the URL.
  • $_COOKIE[ ] which is data written to the browser client and resides on the client computer.
  • $_SESSION[ ] which is data kept on the server and is pretty much unrestricted.

Lab 8

This lab is to test your knowledge of being able to create a login page that users must go to before being able to go to your other pages that contain customer database operations.  Also this assignment will verify your ability to use cookies and session variables.

The lab must contain several items.  Your resulting output should like similar to this.

lab8a variation.

Create a table named "loginaccess" on the server.

Create these fields:
ID - Unique ID number for each entry.  This field is the primary key.
username- Login name.
password - Password.
email - Email Address.

Create at least 4 records.  Populate all the fields.

One record must have a username of "test" with a password of "abc123" and an email address of orders(at)ridgewater.net.

Another record must have your Ridgewater email ID with a password that is your student ID (with preceding zeros) and your ridgewater email address.

The two remaining username/password/email records are of your choosing.

I am requiring the test/abc123/orders(at)ridgewater.net record so I can test your finished lab.

Create a subfolder on your web server named "mmdt1146lab8".  (This may already be done for you from doing the in class exercises.)

Copy your working lab7 files into the lab8 subfolder.  Verify that your lab8 works before continuing further.

Under the lab8 subfolder you will need to create a few new files.  The names are of your choosing.  In my example, I called mine "login.php", "forgotpassword.php" and "lookupemail.php".

Title your pages.
Put a caption on the top of your pages.
Add a background.

Create the page login.php :

  • Create a login form.  (Dreamweaver wizard)
  • On successful login go to form.php.  (Dreamweaver wizard)
  • On failed login go back to login.php.  (Dreamweaver wizard)
  • Modifiy the Dreamweaver created script so that if it is a failed login, a message gets printed.

Modify the page form.php :

  • Authenticate users .  (Dreamweaver wizard)
  • On failed login go back to login.php.  (Dreamweaver wizard)

Modify the page add.php :

  • Authenticate users .  (Dreamweaver wizard)
  • On failed login go back to login.php.  (Dreamweaver wizard)

Modify the page delete.php :

  • Authenticate users .  (Dreamweaver wizard)
  • On failed login go back to login.php.  (Dreamweaver wizard)

Modify the page edit.php :

  • Authenticate users .  (Dreamweaver wizard)
  • On failed login go back to login.php.  (Dreamweaver wizard)

Create the page forgotpassword.php :

  • Have the user enter an email address that would have used. (standard form)
  • The form action should take you to lookupemail.php.

Create the page lookupemail.php :

  • Lookup the row that the password was in. (Dreamweaver wizard)
  • Once you have this page working, hide the user info looked up.
  • email the username/password to the user.

Assignment is due 1 week from when it was assigned.  50% penalty if late.

MMDT 1146 Lab 8
Grading Criteria
Date:
Possible
Points
20
Your
Points
20
Table loginaccess created on the server . 2 2
The fields have been created in the table and populated. 2 2
Login form created. (login.php) 2 2
Failed login message printed. (login.php) 2 2
Authenticate users. (form.php) 2 2
Authenticate users. (add.php) 2 2
Authenticate users. (delete.php) 2 2
Authenticate users. (edit.php) 2 2
Forgot password form. (forgotpassword.php) 2 2
Lookup email and send to user. (lookupemail.php) 2 2