Add this to the top of the page
<?php
session_start();
?>
Also you could add this:
<?php
if (!isset($_SESSION["auth_username"])) {
echo "You must be logged in to view this page";
exit;
}
else {
echo "";
}
?>
the auth_username you can change to auth_password but use this line of code too:
To use logout, just create a form with a button instead like so:
<form action="logout.php" method="post">
<input type="submit" name="sent" id="sent" value="Logout" /></form>
then in the logout.php file you just put the following code:
<?php session_start();
session_destroy();
header("Location: success.php");
//This is the location where you want the user to go after the session has been destroyed
?>
Hope this helps