I have one page session.php and my code is:
@session_start();
if(!isset($_SESSION['uname']) || $_SESSION['uname'] == " " || !isset($_SESSION['uid']) || $_SESSION['uid'] == " ")
{
echo "<script language='javascript'>";
echo "window.location='../index.php'";
echo "</script> ";
exit;
}
And I also want to edit session timeout function this code is:
$_SESSION['start'] = time(); // taking now logged in time
$_SESSION['expire'] = $_SESSION['start'] + (1* 10) ; // ending a session in 30 seconds
$now = time(); // checking the time now when home page starts
if($now > $_SESSION['expire'])
{
session_destroy();
echo "Your session has expire ! <a href='logout.php'>Click Here to Login</a>";
}
else
{
echo "This should be expired in 1 min <a href='logout.php'>Click Here to Login</a>";
}
But this code is not working so help me how can I set session time out in session.php page.
Thank You..