I have a php page (index.php) in which after verifying the username and password a session will be set($_SESSION['expire']) that will be expired and unset after 30 mins (30 mins after pressing the login button) and will redirect us to index.php again:
header('location:index.php');
After verifying, a menu will be shown in index page that one of its item is ContentManager.php. As shown below by clicking this item we will connected to the db and will enter contentmanager.php
switch($_REQUEST['action'])
{
case 'ContentManager' :
include('model/content.php');
$contents = getContent($conn);
include('view/contentmanager.php');
break;
}
in the ContentManger.php I have:
<?php
//if the session is not unset and expired yet
if ( isset($_SESSION['expire']) && ($now<= $_SESSION['expire']))
{
?>
do sth...
<?php
}
else
{
//unset the session and redirect to index.php again
unset($_SESSION['expire']);
session_destroy();
header('location:../index.php');}
?>
This works fine, but the problem is that after passing 30 mintues I have to press "ContentManager" 2 times to redirect to index.php If I just press it one time a blank page with be shown. But by refreshing the page for second time it will redirect to login page (index.php) again.
Please help me...