Source Code for /public/06-retaining-state/members.php
<?php
session_start();
if( ! $_SESSION['logged_in'] ) {
header( 'HTTP/1.1 403 Forbidden' );
?>
<h1>Forbidden</h1>
<p>
You're not logged in, so you can't access this page.
<a href="login.php">Log in</a> to continue.
</p>
<?php
die();
}
?>
<h1>Members area</h1>
<p>
Welcome to the members area!
</p>
<p>
If this was a real members area, there'd be all kinds of secret things here!
</p>
<ul>
<li>
<a href="login.php?logout=true">Log out</a>
</li>
</ul>