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. Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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.