Mini-project 3: Server-side state
Instructions
This project focuses on saving state on a server. Specifically, we'll be looking at using cookies to store a user's name as entered via a form.
You should create a single PHP file named mp3.php. This script will be responsible for the following:
- if the cookie 'login' has been saved for a user, display:
- a message welcoming the user by name
- a button to sign out, which sends a POST variable logout to mp3.php
- if the POST variable name is received, set the cookie, then display the information above
- if the cookie 'login' is not set, or if the POST variable logout
is received, unset the 'login' cookie and present a form with:
- a message saying "Please log in"
- a text box for a name
- a button to submit that sends the data via POST to mp3.php
In performing this assignment, you may find this page on PHP helpful, as well as this page on HTML forms.
Submission
Your file should be located on Joust in the directory ~/public_html/csc401/mp3/, in addition to being uploaded to Canvas. The rubric can be found here. The Canvas submission page is here.
(Back to top)