Re: Overriding session length in existing session?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/03/2011 04:31 PM, tedd wrote:
> At 2:58 PM -0800 3/3/11, Scott Baker wrote:
>> 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?
> 
> Simple answer -- put session_start() at the start of your code -- first
> line.

Of index.php or header.php? You lost me.

-- 
Scott Baker - Canby Telcom
System Administrator - RHCE - 503.266.8253

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux