// CHECK IF COOKIE EXISTS AND GET IT IF IT DOES
$session_key = isset($_COOKIE[SESSION_NAME]) ? $_COOKIE[SESSION_NAME] : false;
// NO VALID KEY - NOT LOGGED IN - BOUNCE TO LOGIN PAGE
// SPECIFICALLY CHECK THAT THE SESSION KEY IS VALID
// DONT JUST CHECK FOR EXISTENCE
if (!isSessionValid($session_key)) {
header('location: login.html');
}
// IF YOU GET HERE - USER SESSION IS VALID
// OPTIONALLY RESET THE TIMEOUT ON THE SESSION
set_cookie(SESSION_NAME, $session_key, time() + 3600, '/');
// NOTE: NO BROWSER OUTPUT TO HAPPEN BEFORE HERE
isSessionValid is a custom function that would be specific to your user authentication scheme.
Then I multiply time() * 60 * 60 * 24 * 365 correct?
Thanks - Google was giving me some really bad old examples from early PHP 5