Hello,
I am creating login system with session for secure login and logout. Yet, I don't think it works as it suppose to be.
This is my codes:
admin.php
<?php
// Check if session is not registered, redirect back to main page.
// Put this code in first line of web page.
session_start();
if(!$_SESSION['username'])
{
header("location:index.php");
exit;
}
?>
<li><a href="logout.php">Logout</a></li>
logout.php
<?php
session_destroy();
header("location:index.php");
?>
After I logout and goes to index.php I still able to enter admin.php just by typing the url address. I wonder why?