Re: [PHP] Sessions , expiry times and different time zones
As I said, **rather** than relying on cookie expiration. This *necessarily* means that you will need to set the cookie expiration to sometime way in the future, like next year (or more dynamically, use the date() and mktime() functions to always set the cookie expiration to + 1 yr from today). If you do this, you will have no chance of the cookie itself expiring; therefore you can rely solely on the $_SESSION variable. The cookie will contain the session id that the webserver will be able to use to repopulate the $_SESSION variable as long as $_SESSION['expiration'] is still in the future. If $_SESSION['expiration'] is in the past (or is empty) and you issue a session_destroy() and a setcookie(), the cookie can be destroyed, too. I have written something similar to this in the past, and it behaves exactly as you would like and expect. Another benefit is that this is more secure than relying on a cookie-supplied expiration time. Jordan On Sep 6, 2005, at 8:51 PM, Dan Rossi wrote: client cookie expires hence no more session ... On 07/09/2005, at 1:57 AM, Jordan Miller wrote: Hi Dan, Couldn't you store an expiration time directly in the $_SESSION variable, rather than relying on cookie expiration (if I understand your question correctly)? Each time a page is loaded, update the expiration time in this variable to +24hr from the current time (all times relative to the server's time). Then, it shouldn't matter from which time zone the user is browsing. Jordan On Sep 6, 2005, at 10:37 AM, Dan Rossi wrote: hi there I have run into problems with sessions , cookies and expiryt times with different time zones. Ie our server is in the States however I am browsing from Koala land downunder. I have been trying to get the session to expire in a day, however for ppl in the states this is ok, but for me its already expired so i have been experiencing issues. How do i solve this ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions , expiry times and different time zones
Dan Rossi [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] client cookie expires hence no more session ... On 07/09/2005, at 1:57 AM, Jordan Miller wrote: Hi Dan, Couldn't you store an expiration time directly in the $_SESSION variable, rather than relying on cookie expiration (if I understand your question correctly)? Each time a page is loaded, update the expiration time in this variable to +24hr from the current time (all times relative to the server's time). Then, it shouldn't matter from which time zone the user is browsing. Read what he said again. Instead of expiring the session itself, store the time of session expiry in the session (with a longer expiry time than 1 day) and check that. When you say a day, do you mean 24 hours or a calendar day? Are you trying to say: Today is Tuesday, so expire this session at midnight on Tuesday? If that's what you need to do, you need to use a client-side solution - after all, only the client knows what time it is where the client is! Be prepared for people who have their time zone set incorrectly. Jordan On Sep 6, 2005, at 10:37 AM, Dan Rossi wrote: hi there I have run into problems with sessions , cookies and expiryt times with different time zones. Ie our server is in the States however I am browsing from Koala land downunder. I have been trying to get the session to expire in a day, however for ppl in the states this is ok, but for me its already expired so i have been experiencing issues. How do i solve this ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions , expiry times and different time zones
hi there I have run into problems with sessions , cookies and expiryt times with different time zones. Ie our server is in the States however I am browsing from Koala land downunder. I have been trying to get the session to expire in a day, however for ppl in the states this is ok, but for me its already expired so i have been experiencing issues. How do i solve this ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions , expiry times and different time zones
Hi Dan, Couldn't you store an expiration time directly in the $_SESSION variable, rather than relying on cookie expiration (if I understand your question correctly)? Each time a page is loaded, update the expiration time in this variable to +24hr from the current time (all times relative to the server's time). Then, it shouldn't matter from which time zone the user is browsing. Jordan On Sep 6, 2005, at 10:37 AM, Dan Rossi wrote: hi there I have run into problems with sessions , cookies and expiryt times with different time zones. Ie our server is in the States however I am browsing from Koala land downunder. I have been trying to get the session to expire in a day, however for ppl in the states this is ok, but for me its already expired so i have been experiencing issues. How do i solve this ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions , expiry times and different time zones
client cookie expires hence no more session ... On 07/09/2005, at 1:57 AM, Jordan Miller wrote: Hi Dan, Couldn't you store an expiration time directly in the $_SESSION variable, rather than relying on cookie expiration (if I understand your question correctly)? Each time a page is loaded, update the expiration time in this variable to +24hr from the current time (all times relative to the server's time). Then, it shouldn't matter from which time zone the user is browsing. Jordan On Sep 6, 2005, at 10:37 AM, Dan Rossi wrote: hi there I have run into problems with sessions , cookies and expiryt times with different time zones. Ie our server is in the States however I am browsing from Koala land downunder. I have been trying to get the session to expire in a day, however for ppl in the states this is ok, but for me its already expired so i have been experiencing issues. How do i solve this ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php