182x Posted July 12, 2007 Share Posted July 12, 2007 Hey guys, Sorry for another newbie question but I have used the following code for a logout page but when I click the logout button the session variables are still on scope. I was just wondering what I did wrong? <?php session_start(); session_destroy(); header("location:index.php") ?> Quote Link to comment Share on other sites More sharing options...
per1os Posted July 12, 2007 Share Posted July 12, 2007 You need to unset the session cookie www.php.net/session_destroy see the examples/user comments about that. Remember if you have the domain/path set for the cookie you need to add those into the setcookie time()-4200 part as well. Quote Link to comment Share on other sites More sharing options...
182x Posted July 12, 2007 Author Share Posted July 12, 2007 I have just tried that and I still have the same problem. Quote Link to comment Share on other sites More sharing options...
per1os Posted July 12, 2007 Share Posted July 12, 2007 try a javascript redirect instead of the header, sometimes they can do weird stuff. If you are on shared hosting than try the www.php.net/session_save_path and changing that as sometimes their permissions are set kinda funky. Quote Link to comment Share on other sites More sharing options...
182x Posted July 12, 2007 Author Share Posted July 12, 2007 does it matter that I have not given the sessions names? 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.