Assigned: Monday, March 30
Due date: Thursday, April 9
The aim of this project is for you to get familiar with setting and reading cookies in PHP.
Create a new page for this project. Name the new page
project9.php. When first visited, this page sets a cookie
name of the cookie is to be your username, e.g. if your erdos
janeuser, the cookie name is
'janeuser'. (This is to keep all the cookies my web
browser is going to be collecting as I grade this project distinct.)
Create a permanent, not session, cookie.
Give the cookie an expiration date 1 week in the future.
Set the value of the cookie to the integer timestamp of the visit. Obtain
this using the PHP
time() function. (This integer is the number of
seconds that have elapsed since a standard date called “the epoch.”)
On later visits, if the cookie is set, its value is printed in a
human-friendly format. You can use
date() function for this. (Feel free to use one of
string constants that specify standard formats.) Include
appropriate text such as “your last visit was:”. The
cookie is then updated to the timestamp of the new visit.
Remember that when the cookie is first set, you will need to reload the page in order for it to appear to the PHP script. This page is closer to the set-cookie example than the welcome example from class. In particular, it does not need a major division into three parts.
Note: Your project page must pass the W3C validator with no more than the unavoidable warning about the experimental HTML5 conformance checker.