I'm trying to set the session with Page1.php, redirect to Page2.php, and then if Page2.php is refreshed, closed, revisited i want it to display a 404 error. This is what I have:
page1.php:
session_start();
$_SESSION['time'] = 'time';
header('location: page2.php');
exit;
page2.php:
session_start();
if( !isset( $_SESSION['time'] ) ) {
header("Location:http://google.com");
} else {
echo ( "this session is ". $_SESSION['time'] );
}
How do I add the function so page2.php expires if refreshed? I just want the page2.php url to expire for the user after the browser session ends