When a user clicks on a link and they get to the next page, it starts a session which long story short, tells the database to make that link unavailable. They only have 30 minutes to do what they are supposed to do on this page, before the database resets making the link available again.. How can I make it so that the user cannot sit and stay on the page keeping the link unavailable or clicking refresh to stay on same page?
So basically, is there a way I can automatically redirect the user to another page WITHOUT them clicking on anything? The page should redirect them to another page when session expires no matter what.
I dont think I can use this because I want the redirect dependent on when the session expires.
header("Refresh: 60; Location: /path/somepage.php");
Any help would be extremely helpful!
** EDIT, the 30 minutes is defined in the session. So its all about the session..
$now = time();
$_SESSION['start'] = time(); // taking now page start time
$_SESSION['expire'] = $_SESSION['start'] + (1 * 60) ; // ending a session in 30
$outOfTime = $_SESSION['expire'] - $_SESSION['start'];
if($now > $_SESSION['expire'])
{
header("Refresh: $outOfTime ; Location: /path/redirect.php");
}
Session timer set to 1 minute for testing purposes.