I had a site using cookies, but I've moved it to sessions, but the behavior is the same. Under Opera or IE, it always 'loses' the cookie/session information when someone closes the browser. I'd like to keep the user logged in so when they come back it's not asking them to login again.
I have code at the begining of all my pages that calls session_start() (it used to see if $who was set) and if it isn't, it sent them to the login page. It works fine once they've logged in though. When I was using cookies, I was using 0 expire time.
I have the win32 build of 4.1.xx
<?php
session_start();
if ($PHP_SELF != "/login.php") {
if (!$user || !$host || !$who || !$database) {header("Location: /login.php");}
}
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?>