Possible Duplicate:
How do I expire a PHP session after 30 minutes?
I have a session
$_SESSION['uid'];
Is there a simple script to end this session after 30 minutes? Any help is greatly appreciated.
Possible Duplicate:
How do I expire a PHP session after 30 minutes?
I have a session
$_SESSION['uid'];
Is there a simple script to end this session after 30 minutes? Any help is greatly appreciated.
// Inialize session
session_start('admin');
// set timeout period in seconds
$inactive = 30;
// Check, if user is already login, then jump to secured page
if (isset($_SESSION['admin'])) {
$session_life = time() - $_SESSION['admin'];
// Jump to secured page
header('Location: securedpage.php');
if($session_life > $inactive) {
session_destroy();
// Jump to Logout page
header("Location: logout.php");
}
}
$_SESSION['timeout'] = time();