|
Posted by John Murtari on 08/21/07 16:01
>> When a user logs into our site, we create a session variable to
>> denote
>> the session is active and another to denote who is logged in. Once
>> the user closes the browser and re-opens it, the session is destroyed
>> and the variables are gone.
>> How can I keep the session alive for 24 hours even if the user closes
>> and re-opens the browser?
>
> The whole purpose of sessions is to keep short-term data until the
> "connection" is closed. If you need persistence, create a normal,
> long-term cookie via setcookie() and read it from the $_COOKIES array.
>
Yes, pay attention to this comment. I work at a web provider
and 'session' storage is not free. The data is stored in a directory
and depending on php.ini settings data is purged (unless there is an
explicit logout, the server never know if it is okay to destroy the
session data). Right now that data is being periodically purged
for you at the server end -- even if you increased the 'lifetime', it
is quite possible your provider will purge the session data due to
inactivity - or - you could have a LOT of session data pile up.
If you just want to remember their login name for when they
come back, just a simple cookie might be best.
Best regards!
--
John
___________________________________________________________________
John Murtari Software Workshop Inc.
jmurtari@following domain 315.635-1968(x-211) "TheBook.Com" (TM)
http://thebook.com/
[Back to original message]
|