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") ?> Link to comment https://forums.phpfreaks.com/topic/59696-logout-problem/ 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. Link to comment https://forums.phpfreaks.com/topic/59696-logout-problem/#findComment-296703 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. Link to comment https://forums.phpfreaks.com/topic/59696-logout-problem/#findComment-296707 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. Link to comment https://forums.phpfreaks.com/topic/59696-logout-problem/#findComment-296712 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? Link to comment https://forums.phpfreaks.com/topic/59696-logout-problem/#findComment-296715 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.