The Hypertext Transfer Protocol (HTTP) is stateless, which vastly simplifies its implementation because a web server does not retain information across requests. Unfortunately, web applications require maintaining state – e.g., to implement a shopping cart. Cookies and sessions are two ways to maintain state about a user’s interactions to overcome this limitation of HTTP.

Learning Objectives

  • Describe an HTTP cookie
  • Use PHP sessions to implement authentication for web pages
  • Compare and contrast HTTP cookies and PHP sessions to track state

How to Complete this Lesson

  1. Read HTTP cookies (10–15 minutes)
  2. Review the handout (10–15 minutes)
  3. Optional: Read about the following Web APIs that provide alternatives to cookies for client-side storage
  4. Complete the web development programming exercise (PEX) (120 minutes)
    • Create an alternative CSS theme
    • Add feature(s) to the website

Due

As a reminder, the following is due this lesson: