after login if i click logout (logout.php) its nor redirecting to login page. its stuck in logout.php page.
logout.php
<?php
session_start();
session_destroy();
if(!$_SESSION['username']){
header("Location: login.php");
}
?>
index.php
<?php
include("config.php");
session_start();
$usern = $_SESSION['username'];
//if(!isset($_SESSION['sess_user_id']) || (trim($_SESSION['sess_user_id']) == '')) {
if(!$_SESSION['username']){
header("location:login.php");
} ?>
<div class="cssmenu">
<ul>
<?php if($usern){ ?>
<li><a href="logout.php">Log Out</a></li>
<?php }
else { ?>
<li><a href="login.php">Log In</a></li> |
<li><a href="register.html">Sign Up</a></li>
<?php } ?>
</ul>
</div>