01 HTML Basics 02 Text Exercises 03 Text Formatting 04 Link Exercises 05 Images & Lists 06 CSS Margin 07 CSS Padding Left 08 CSS Outline 09 CSS Table Styling 10 CSS Dimensions 11 MySQL Database 12 Session Management

Activity 12: Session Management

This activity demonstrates a functional login and logout system using PHP sessions. A session allows the website to remember if a user is logged in across multiple pages.

Use the test credentials below, then try opening the Members Only page while logged in and logged out.

Test Account — Username: admin  |  Password: admin123
Go to Login Page Open Members Only Page Logout

How Sessions Work

When a user logs in successfully, PHP stores their identity in a session:

Protecting a Page

Any page that requires login checks the session at the top: