15.4 Protected Area
Sessions are commonplace on PHP-based websites. Online stores in particular, whether from booksellers or tour operators, are no longer possible without sessions. The basis of all these applications is the same: data is managed in a session.
One classic application on the web is that certain areas of a website (such as the customer area) are only available if the user has previously authenticated themselves. A session variable is used here to store whether the user is authorized or not. If yes, the page content is displayed; if no, the user is redirected to the login page.
The application consists of two parts: first, an include file in which a check is carried out for the existence of the session variable. If this variable ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access