Sample Session Management Mechanism
In order to elaborate on the principles introduced in this chapter, this section introduces an example PHP script that implements some basic session-management features. This example borrows heavily from the example state management mechanism introduced in the previous chapter in order to demonstrate the characteristic that session management is an enhancement to state management.
This example only makes use of a session data store and does not utilize a separate data store for persistent user data. The session data store used in this example is flexible enough to accommodate most situations, and the persistent data store for user records (such as where you might store a username and password) varies ...