severndigital Posted May 23, 2007 Share Posted May 23, 2007 ok .. i am trying to do a simple logout from a page. i was going to use this code <? $kill = session_destroy(); if(!empty($_SESSION['authenticate'])){ $message = 'There was a problem logging out. Check with Chris.'; $div_content = 'pages/empty.php'; } else { $message = 'You have logged out successfully. See you later.'; $div_content = 'pages/login.php'; } ?> i'm sure it's something stupid that is causing it to not work correctly. it seems to log me out and destroy the session but only after it runs the entire script. when i run the script i get the $message var for and error. when i refresh the page i get the $message var for success. please any help would be great. thanks, chris Quote Link to comment https://forums.phpfreaks.com/topic/52709-solved-logout-using-session_destroy/ Share on other sites More sharing options...
hitman6003 Posted May 23, 2007 Share Posted May 23, 2007 From the manual... session_destroy() destroys all of the data associated with the current session. It does not unset any of the global variables associated with the session, or unset the session cookie. http://www.php.net/session_destroy Quote Link to comment https://forums.phpfreaks.com/topic/52709-solved-logout-using-session_destroy/#findComment-260245 Share on other sites More sharing options...
severndigital Posted May 24, 2007 Author Share Posted May 24, 2007 thanks.. i can be a dope sometimes. my brain was fried yesterday. sorry for the bum post. Quote Link to comment https://forums.phpfreaks.com/topic/52709-solved-logout-using-session_destroy/#findComment-260616 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.