soycharliente Posted July 2, 2009 Share Posted July 2, 2009 I searched the forum, only found 1 vaguely relevant post and it was about sessions wrt to cookies. So if I missed something, let me know. Is this teh best way to clear sessions in your opinion? This is the code in my logout file. <?php session_start(); session_regenerate_id(TRUE); $_SESSION = array(); header('Location: /'); exit(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/164579-solved-clearing-sessions/ Share on other sites More sharing options...
Adam Posted July 2, 2009 Share Posted July 2, 2009 There's a built-in function to destory the session, PHP reccommend using the $_SESSION = array(); statement as well. http://php.net/manual/en/function.session-destroy.php Quote Link to comment https://forums.phpfreaks.com/topic/164579-solved-clearing-sessions/#findComment-868058 Share on other sites More sharing options...
soycharliente Posted July 2, 2009 Author Share Posted July 2, 2009 Yeah, I used that and it didn't work. If you'd like to help me figure out why, I'm up for it. Maybe it was the order of everything? It used to look like this: <?php session_start(); session_destroy(); header('Location: /'); exit(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/164579-solved-clearing-sessions/#findComment-868059 Share on other sites More sharing options...
soycharliente Posted July 2, 2009 Author Share Posted July 2, 2009 Wow. It's working like that. Great. However, curious why the PHPSESSID value isn't changing. Don't I want that to change to be completely sure? Quote Link to comment https://forums.phpfreaks.com/topic/164579-solved-clearing-sessions/#findComment-868060 Share on other sites More sharing options...
Adam Posted July 2, 2009 Share Posted July 2, 2009 Read the manual... Quote Link to comment https://forums.phpfreaks.com/topic/164579-solved-clearing-sessions/#findComment-868061 Share on other sites More sharing options...
soycharliente Posted July 2, 2009 Author Share Posted July 2, 2009 great thanks Quote Link to comment https://forums.phpfreaks.com/topic/164579-solved-clearing-sessions/#findComment-868062 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.