i read many articles about it but i cant find out how to solve my problem. When my script unset session a simply want to redirect him to login when he can easily login and get back on page where he was logged out.
public static function expired()
{
if (isset($_SESSION['logged_id']))
{
if (time() - $_SESSION['time'] > 3600)
{
header('Location: http://nostools.cz/scripts/logout.php');
$_SESSION['last_visited'] = $_SERVER['REQUEST_URI'];
} else {
$_SESSION['time'] = time();
return true;
}
}
}
public function logout()
{
$onlinedestroy = Query::getInstance()->delete('online', array('user_id', '=', $_SESSION['logged_id']));
unset($_SESSION['logged_id']);
$this->redirect("http://nostools.cz/content/login/");
}
this scrip is on every page. In $_SESSION['last_visited'] is logout.php and i need to get previous page i also tried to use $_SERVER['HTTP_REFERER']. Can somebody tell me how i can get previous page?