[PHP] Re: PHP SESSION DURATION.....

2003-11-25 Thread Keith
Correction: I meant to say: Are session variables stored server-side or
client-side like cookies?

Keith [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,
 How do I go about making a session last longer that the duration of the
 browser?
 Say I wanted to make a session last for 1 month, so that I could close the
 browser as often I wanted, and the session would still be there. I found
the
 explanations of the session function on PHP.net quite confusing. G...
 Oh for good documentation!!!

 Should I use session_cache_expire? Well, php.net says: The cache expire is
 reset to the default value of 180 stored in session.cache_limiter at
request
 startup time.
 What about session_set_cookie_params? But php.net says the effect of this
 function only lasts for the duration of the script?

 Are session variables stored server-side or does that apply to cookies
only?
 And what about session cookies? Are session cookies stored with the
client?

 Please help

 Many thanks
 Keith

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



Re: [PHP] Re: PHP SESSION DURATION.....

2003-11-25 Thread Larry E. Ullman
Correction: I meant to say: Are session variables stored server-side or
client-side like cookies?
The session data is stored on the server. The session cookie (if there 
is one) is stored in the browser.

How do I go about making a session last longer that the duration of 
the
browser?
Set the expiration on the session cookie so that it's a month from now, 
using the set_session_cookie_params() function. Also, force the users 
to accept cookies (somehow). Then change the garbage collection so that 
it won't trash session data for at least a month.

Considering how inefficient all of that is, you might be better off 
storing the data in a database instead of a session and then storing 
the database record ID in a cookie in the browser. There are some 
serious security considerations here but it will get your results and 
won't rely upon PHP's sessions. Again, this isn't ideal but it's a 
start...

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