Re: Sessions that last for ever
| From: | Nigel Gilbert | Date: | Sat, 16 Feb 2002 20:10:00 +0000 |
| Subject: | Re: Sessions that last for ever | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-85059@lists.php.net to get a copy of this message | ||
But very many commercial sites, including Apple and Amazon to name two, do exactly this. When you re-enter the site they 'remember' who you are using a cookie. In my case, I'm building a multi-player strategy game and while I want the players to go through an initial briefing the first time they ever join the game, thereafter they should be able to get straight into the game if they are still using the same PC. But as I said, the specifics of my use aren't so important - lots of sites leave permanent cookies around and the results don't seem to be catastrophic.
The question is still: how to do it?
Nigel
On Saturday, February 16, 2002, at 07:52 PM, Erik Price wrote:
On Saturday, February 16, 2002, at 07:43 AM, Nigel Gilbert wrote:Professor Nigel Gilbert, FREng, AcSS, Pro Vice-Chancellor and Professor of Sociology, University of Surrey, Guildford GU2 7XH, UK. +44 (0)1483 689173By default, a session (created with session_register) seems to last just as long as the user has their browser open. If a user quits the browser, the session is automatically destroyed. I want a session to last indefinitely (or until my program destroys it). There are some hints about how this could be done with cookies in the documentation, but not a clear recipe. What sequence of PHP statements should I use to achieve this?I don't have the answer you're looking for (maybe it's a php.ini setting), but I suspect that it might be a dangerous idea. The longer a session ID is hanging about, the easier it is for a cracker to hijack it and use it for evil intent. Remember, every time a page is requested within any given session, either a cookie variable or a GET variable is being sent along with the HTTP headers. Keeping a session going for more time than needed means that the variable representing the session ID is leaving footprints all over the place. Erik <-- who has become overcautious lately upon learning how HTTP works ---- Erik Price Web Developer Temp Media Lab, H.H. Brown pricee@hhbrown.com __________________________________________________________________________