15.2. Session Management

PHP's concept of session management is more sophisticated than working with cookies. With the help of sessions, it is possible to track a user without working with hidden fields or cookies explicitly. This has significant advantages. You gain a lot of flexibility, and working with sessions will help you to implement components much more efficiently.

Let's take a look at the basic concepts of session management. When a user visits a Web site, a unique id is assigned to the user. The session id is either stored in a cookie or is passed to the next script via the URL.

In addition to using a session id, you can register variables. These variables can easily be extracted again, and so it is a fairly easy task to pass information ...

Get PHP and PostgreSQL: Advanced Web Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.