Chapter 21. Using MySQL-Based Web Session Management
Many web applications interact with users over a series of requests and, as a result, must retain information from one request to the next. A set of related requests is called a session. Sessions are useful for activities such as performing login operations and associating a logged-in user with subsequent requests, and gathering input from a user in stages (possibly using earlier responses to tailor later questions). However, HTTP is a stateless protocol, so web servers treat each request independently of any other—unless you take steps to ensure otherwise.
This chapter shows how to make information persist across multiple requests, which enables you to develop applications for which one request retains memory of previous ones. The techniques shown here are general enough to apply to a variety of state-maintaining web applications.
Session Management Issues