phpQuestioner Posted April 1, 2007 Share Posted April 1, 2007 How do you destroy a PHP cookie after 30 minutes of user inactivity time? Quote Link to comment https://forums.phpfreaks.com/topic/45117-solved-destroying-a-php-cookie-based-on-inactivity-time/ Share on other sites More sharing options...
MadTechie Posted April 1, 2007 Share Posted April 1, 2007 setcookie("TestCookie", $value, time()+1800); /* expire in 30 minutes */ Quote Link to comment https://forums.phpfreaks.com/topic/45117-solved-destroying-a-php-cookie-based-on-inactivity-time/#findComment-219029 Share on other sites More sharing options...
phpQuestioner Posted April 1, 2007 Author Share Posted April 1, 2007 yeah, that is the way I have it now. but I want to be able to delete the cookie if more than 30 minutes of inactivity occurs on a page; otherwise the cookie will still remain set. I know that if I had used sessions instead of cookies; this could have been accomplished; but I went the setcookie route. Quote Link to comment https://forums.phpfreaks.com/topic/45117-solved-destroying-a-php-cookie-based-on-inactivity-time/#findComment-219032 Share on other sites More sharing options...
MadTechie Posted April 1, 2007 Share Posted April 1, 2007 Just use the setcookie on all the actions, thus it will always get set back to 30 minutes, Quote Link to comment https://forums.phpfreaks.com/topic/45117-solved-destroying-a-php-cookie-based-on-inactivity-time/#findComment-219035 Share on other sites More sharing options...
phpQuestioner Posted April 1, 2007 Author Share Posted April 1, 2007 MadTechie that would probably work out ok; thanks for the suggestion. Quote Link to comment https://forums.phpfreaks.com/topic/45117-solved-destroying-a-php-cookie-based-on-inactivity-time/#findComment-219036 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.