0

I am trying to timeout the session after 10 minutes I have been working on this code for some time but there is something seriously wrong with it because when I load the page up it says "Firefox has detected that the server is redirecting the request for this address in a way that will never complete."

 <?php
require_once 'db_connect.php';
session_start();
if(!$_SESSION\['name'\])
{
header("Location:login.php?id=Unauthorised access");
}
?>
<?php
session_start();
if( !isset( $_SESSION\['name'\] ) || time() - $_SESSION\['login_time'\] < 600)
{
    header("Location:login.php?id=session expired");
}
else
{

    $_SESSION\['login_time'\] = time();
    echo ( "this session is ". $_SESSION\['user_id'\] );
    //show rest of the page and all
}
?>
<?php 

session_start();
session_regenerate_id(false);session_destroy();session_start();

   if ($_SESSION\['login_time'\] = time())
{
    header("Location:cakeform.php");            
}
else
{
    header("Location:login.php?id=sessionexpired");
}
?>

0 Answers0