acctman Posted July 31, 2007 Share Posted July 31, 2007 my logout process doesn't seem to be working. when the user clicks logout the session remains. from what I can see the cookie is being deleted but its still leaving the user logged in. http://www.site.com/index.php?req=logout index.php if ($req == 'logout') include 'includes/verify_session.php'; verify_session.php //process logout if ($req == "logout") { ob_clean(); $_SESSION = array(); if ($term==1) { header("Location:".constant('dir').'index.php?req=login&login_message='.urlencode("Your Account has now been Suspended and within the next 48hrs it will automatically be deleted. As of right now your account is no longer visible on the site.")); }else{ header("Location:".constant('dir').'index.php?req=login&login_message='.urlencode(_logged_out)); } setcookie('remember','FALSE',time()-360000,constant('dir')); exit; } Quote Link to comment https://forums.phpfreaks.com/topic/62683-deleting-cookie-for-logout-session/ Share on other sites More sharing options...
deadimp Posted July 31, 2007 Share Posted July 31, 2007 If you're using sessions, why do have a separate cookie? You should look into the PHP Manual on session functions and see how you can alter the session id's cookie (such as expiration, etc). Why are you using the code $_SESSION=array(); ? That might work, but I doubt it will. Use session_destroy() to clear your data (you can find more info on this in the manual). Also, why do you pass your status notification in the URL query? That isn't the best method you can use. Quote Link to comment https://forums.phpfreaks.com/topic/62683-deleting-cookie-for-logout-session/#findComment-312057 Share on other sites More sharing options...
acctman Posted July 31, 2007 Author Share Posted July 31, 2007 If you're using sessions, why do have a separate cookie? You should look into the PHP Manual on session functions and see how you can alter the session id's cookie (such as expiration, etc). Why are you using the code $_SESSION=array(); ? That might work, but I doubt it will. Use session_destroy() to clear your data (you can find more info on this in the manual). Also, why do you pass your status notification in the URL query? That isn't the best method you can use. unfortunantely thats how the script was made =( not the best coding. for a person like me that is learning PHP it doesn't good coding to learn from. Quote Link to comment https://forums.phpfreaks.com/topic/62683-deleting-cookie-for-logout-session/#findComment-312076 Share on other sites More sharing options...
deadimp Posted July 31, 2007 Share Posted July 31, 2007 If you're learning from an online tutorial, and that's how they wrote it, I'd suggest looking for another one. Quote Link to comment https://forums.phpfreaks.com/topic/62683-deleting-cookie-for-logout-session/#findComment-312085 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.