Web Development Exercise 9-2

Mar 8th, 2015
Computer Science
Price: $5 USD

Question description

Exercise 9-2
                  In this project, you will create a cookies program that stores the date
                  and time of a user’s last visit.
                     1.   Create a new document in your text editor and type the
                           declaration,  element, header information,
                          and  element. Use the strict DTD and “Last Visit” as
                          the content of the  element.
                     2.   Add the following script section above the 

                     3.   Add the following if...else statement to the script sec-
                          tion to assign a value to the $LastVisit variable. If the
                          $_COOKIE['lastVisit'] variable is set, the date and time of
                          the last visit is assigned to the $LastVisit variable. Otherwise,
                          the variable is assigned a value of “This is your first visit!”
                          if (isset($_COOKIE['lastVisit']))
                               $LastVisit = "Your last visit was on "
                                    . $_COOKIE['lastVisit'];
                               $LastVisit = "This is your first visit!\n";

                     4.   Add the following statement to the end of the script sec-
                          tion. The statement uses the date() function with the
                          setcookie() function to assign the date to the $LastVisit
                          variable. Notice that the cookie is set to expire in one year.
                          setcookie("lastVisit", date("F j, Y, g:i a"),

                     5.   To the document body, add the following output directive,
                          which displays the value of the $LastVisit variable:

                     6.   Save the document as LastVisit.php in the Projects direc-
                          tory for Chapter 9, and then close the document in your text

 7.   Open the LastVisit.php file in your Web browser by enter-
        ing the following URL: http:///PHP_Projects/
        Chapter.09/Projects/LastVisit.php. The first time you open the
        page, you should see “This is your first visit!” in the browser
        window. Reload the Web page; you should see the date and
        time in the browser window.
   8.   Close your Web browser window.

Tutor Answer

(Top Tutor) Daniel C.
School: UC Berkeley

Studypool has helped 1,244,100 students

Review from our student for this Answer

Mar 12th, 2015
"Outstanding Job!!!!"
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1823 tutors are online

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors