I'm trying to redirect to the logout page after a certain elapsed time, momentary set to one minute for testing purposes.
This is my session script:
The script is in an include file.
The original script only had lines 2 and 3, I added the rest. Sadly it want redirect. Can anybody detect a mistake?
With kind regards,
Ad.
This is my session script:
PHP Code:
<?php
session_start();
//session_register("session");
$timeout = 1; // Set timeout minutes
$logout_redirect_url = "logout.php"; // Set logout URL
$timeout = $timeout * 60; // Converts minutes to seconds
if (isset($_SESSION['start_time'])) {
$elapsed_time = time() - $_SESSION['start_time'];
if ($elapsed_time >= $timeout) {
session_destroy();
header("Location: $logout.php");
}
}
$_SESSION['start_time'] = time();
?>
The original script only had lines 2 and 3, I added the rest. Sadly it want redirect. Can anybody detect a mistake?
With kind regards,
Ad.
Comment