shergold Posted July 13, 2009 Share Posted July 13, 2009 Hey guys, could anyone please tell me whats wrong with the following? it just keeps redirecting to the login page even when the session is set and isnt destroying the session: if (isset($_SESSION['user'])) { session_start(); session_destroy(); header("location: /login.php?logout=true"); exit; } else { header("location: /login.php"); } ?> Thanks, shergold. Link to comment https://forums.phpfreaks.com/topic/165838-solved-isset-session/ Share on other sites More sharing options...
nloding Posted July 13, 2009 Share Posted July 13, 2009 I'm pretty sure that the $_SESSION variables are NULL until you run session_start() ... so put the session_start() outside your if/else. Link to comment https://forums.phpfreaks.com/topic/165838-solved-isset-session/#findComment-874739 Share on other sites More sharing options...
shergold Posted July 13, 2009 Author Share Posted July 13, 2009 ah yes thanks allot, it worked, i dont know why i didnt think of that. Thanks allot, shergold. Link to comment https://forums.phpfreaks.com/topic/165838-solved-isset-session/#findComment-874740 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.