I have a global header.php file that sets up a bunch of stuff: DB,
global variables, and does session_start(). My header.php looks like this:
#header.php
$cookie_life = (86400 * 7); // Cookies last for seven days
session_set_cookie_params($cookie_life,"/",".domain.com",true);
session_start();
This is called globally in *all* my scripts. In another script I'd
really like to set the session to expire after the browser closes if a
uses clicks "public terminal" or something.
I thought I could just set the session cookie to expire after the
browser closes. Can I override the already started session by doing
something like this in my index.php:
#index.php
include('header.php');
setcookie(session_name(), '', 0 ,"/",".domain.com");
When I do this the session expires IMMEDIATELY. I must be missing something?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php