mike177 Posted February 10, 2008 Share Posted February 10, 2008 Hi, I need a little help with cookies. I want m cookies on my site to never expire unless the browser is closed or the user logout. On the php site it says to set the expire to 0. I tried this and the cookie expired a few seconds later. Does any one have some suggestions. Thanks in advance for any help. Quote Link to comment Share on other sites More sharing options...
marcus Posted February 10, 2008 Share Posted February 10, 2008 See the expire to like: time()+3600*24*365*10 That's 10 years for ya. Quote Link to comment Share on other sites More sharing options...
revraz Posted February 10, 2008 Share Posted February 10, 2008 You are asking for two different things. You say never to expire unless the browser is closed. Setting it to 0 or no time means it will expire when the browser closes. So do you want it to "never" expire (which is not possible) or do you want it to expire when the browser is closed? Hi, I need a little help with cookies. I want m cookies on my site to never expire unless the browser is closed or the user logout. On the php site it says to set the expire to 0. I tried this and the cookie expired a few seconds later. Does any one have some suggestions. Thanks in advance for any help. Quote Link to comment Share on other sites More sharing options...
mike177 Posted February 10, 2008 Author Share Posted February 10, 2008 You are asking for two different things. You say never to expire unless the browser is closed. Setting it to 0 or no time means it will expire when the browser closes. So do you want it to "never" expire (which is not possible) or do you want it to expire when the browser is closed? Hi, I need a little help with cookies. I want m cookies on my site to never expire unless the browser is closed or the user logout. On the php site it says to set the expire to 0. I tried this and the cookie expired a few seconds later. Does any one have some suggestions. Thanks in advance for any help. Yea I just want the cookie to expire either when the user clicks the logout link to execute the logout script or when the user closes the browser. So I want the cookie to last as long as the user is logged in. Quote Link to comment Share on other sites More sharing options...
rofl90 Posted February 10, 2008 Share Posted February 10, 2008 I use time()+3600*24*365*120 and on the unthinkable likeliness of them having fun on your site for 120 years, increase the '120' without quotes number. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted February 10, 2008 Share Posted February 10, 2008 when a log out button is clicked the cookie is deleted/unlinked from the server. Yes you are changing the cookies life to delete it, but it doesn't affect the overall life. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.