[PHP] Re: session expired - how to know if the session is new or old
What do you need this for.? You session is only suppose to last for one browser session Catalin Trifu [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, Here is the problem: The session gc runs and deletes the session data. This is good, but calling session_start in PHP obviously creates a new session. How can I know if the session was created after an old one was deleted because gc has invalidated it or it is a completely fresh session, from let's say a fresh browser window. I googled for it and looked in the docs but I found nothing on this matter. Thanks in advance, Catalin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: session expired - how to know if the session is new or old
in the first page of your website, or when you connect for the firs time to it $_SESSION['first_session_value'] = session_id(); others pages if($_SESSION['first_session_value'] != session_id()){ echo The session has a new value; } Seba Il mar, 2004-02-24 alle 15:16, Jakes ha scritto: What do you need this for.? You session is only suppose to last for one browser session Catalin Trifu [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, Here is the problem: The session gc runs and deletes the session data. This is good, but calling session_start in PHP obviously creates a new session. How can I know if the session was created after an old one was deleted because gc has invalidated it or it is a completely fresh session, from let's say a fresh browser window. I googled for it and looked in the docs but I found nothing on this matter. Thanks in advance, Catalin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: session expired - how to know if the session is new or old
Hi, I want to redirect my users to a session expired page and not directly to a blank login page based on wheter this is just a gc colected session. In case the user goes to sleep but leaves the browser open and then in the morning he comes back and does something the browser will send the session id he got before sleeping. Catalin, Jakes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] What do you need this for.? You session is only suppose to last for one browser session Catalin Trifu [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, Here is the problem: The session gc runs and deletes the session data. This is good, but calling session_start in PHP obviously creates a new session. How can I know if the session was created after an old one was deleted because gc has invalidated it or it is a completely fresh session, from let's say a fresh browser window. I googled for it and looked in the docs but I found nothing on this matter. Thanks in advance, Catalin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: session expired - how to know if the session is new or old
Catalin Trifu wrote: I want to redirect my users to a session expired page and not directly to a blank login page based on wheter this is just a gc colected session. In case the user goes to sleep but leaves the browser open and then in the morning he comes back and does something the browser will send the session id he got before sleeping. The only way to accomplish this is to keep a persistant cookie updated with the last time they used a session. Then if someone comes to the site without a session, check for that cookie and present the appropriate page. However, this seems like a lot of effort for little gain to me. -- Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: session expired - how to know if the session is new or old
Thanks for the response. Indeed it seems this is the only way to achieve what I want. It would be nice if the PHP guys would implement such functionality. Catalin Stuart [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Catalin Trifu wrote: I want to redirect my users to a session expired page and not directly to a blank login page based on wheter this is just a gc colected session. In case the user goes to sleep but leaves the browser open and then in the morning he comes back and does something the browser will send the session id he got before sleeping. The only way to accomplish this is to keep a persistant cookie updated with the last time they used a session. Then if someone comes to the site without a session, check for that cookie and present the appropriate page. However, this seems like a lot of effort for little gain to me. -- Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: session expired - how to know if the session is new or old
Catalin Trifu wrote: Thanks for the response. Indeed it seems this is the only way to achieve what I want. It would be nice if the PHP guys would implement such functionality. Why? You're the first person I've ever heard ask for this. I don't think it's something that should be part of the session handling - it's easy enough for the few people who would want it to add it themselves. -- Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php