Page 1 of 1

cookie expires frequently

Posted: Fri Jun 19, 2009 1:47 am
by prajeesh.thomas
Hi
I am using cookie (instead of session) for authentication in my site. the site is hosted in a server inside USA. Now whenever a person access the site from outside USA, we notice a frequent cookie timeout issue. we are setting the cookie using the following lines.

setcookie($this->token_name, $token,time()+1800, '/');


So we assumed that the issue happened due to time difference between the server and the client browser(since the client is outside USA). we tried changing the expire parameter to <clienttime>+1800 instead of time()+1800. Also tried stetting the parameter to 0. Nothing works the cookie expires after a few minutes/seconds compelling the user to log in again. Please help if anyone has an idea.

Thanks

Re: cookie expires frequently

Posted: Fri Jun 19, 2009 2:56 am
by requinix
Use something like Firebug or the Web Developer toolbar (both Firefox addons) to look at how cookies are set as you're using the site.
They can also tell you when the cookie is supposed to expire, but so can Page Info > Security > View Cookies.

That will give you a push in the right direction to solving this.