fanfavorite Posted November 6, 2007 Share Posted November 6, 2007 I read somewhere that if you set a cookie with the expiry value of 0, it becomes a session variable. I have done so below: setcookie("login",$username,0,"/",false); It removes the cookie on browser close, however when other session variables expire because the user is inactive, the cookie is still active. Any ideas on what I need to do to make it expire with inactivity as well? Thanks! -JC Quote Link to comment Share on other sites More sharing options...
atlanta Posted November 6, 2007 Share Posted November 6, 2007 Yea use php to set your session variable as showed here http://us2.php.net/session look over that link . if you need help let us know` Quote Link to comment Share on other sites More sharing options...
fanfavorite Posted November 6, 2007 Author Share Posted November 6, 2007 Thanks for your post. I am aware of how to set and use sessions, but will I have to do it as session to begin with rather than a cookie? The reason I don't want to do this is that our system is huge and has references like $_COOKIE[login] throughout. If I change it, I will have to go through everything and change is to $_SESSION[login]. Is there no way to make the cookie act exactly like a session variable and expire when inactive as well? Quote Link to comment Share on other sites More sharing options...
revraz Posted November 6, 2007 Share Posted November 6, 2007 The Cookie on the user's machine or the Session ID in your Sessions folder on your webhost? Quote Link to comment Share on other sites More sharing options...
atlanta Posted November 6, 2007 Share Posted November 6, 2007 Yea you will have to do it as a session throughout if you want it to work that way.. I have some apps that will go through php files and change certain strings.. if you dont wanna do it this way then have the cookie expire after a period of time, do a survey and see how long the average user stays on.. just throwing some ideas out there Quote Link to comment Share on other sites More sharing options...
fanfavorite Posted November 6, 2007 Author Share Posted November 6, 2007 Ok thanks Atlanta. What apps do you use to search through php files? Quote Link to comment Share on other sites More sharing options...
atlanta Posted November 6, 2007 Share Posted November 6, 2007 http://www.rjlsoftware.com/software/utility/search/download.shtml download that have it setup to only read php files in a directory then have a search string and replace. if you need a pic on how to set it up ill post one up let me know Quote Link to comment Share on other sites More sharing options...
fanfavorite Posted November 6, 2007 Author Share Posted November 6, 2007 Great thanks! 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.