I am having trouble with my session script. I include this file call functions.php in every file I need a session in.
<?php
session_start(); {
if(isset($_SESSION['username']) && !empty($_SESSION['username'])) {
return true;
} else {
return false;
}
}
?>
And then I use this file to logout. Called logout.php
<?php
include('functions.php');
session_destroy();
// We redirect them to the login page
header("Location: homepage.php");
die("Redirecting to: homepage.php");
?>
Can anyone help me fix it so that when a user clicks the logout link they cannot go back to the members area and be logged in again.