homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

logout script not working on localhost

 1:06 pm on Aug 1, 2012 (gmt 0)

I have a logout script like this:

require 'core.php';

$_SESSION = array();
if($_COOKIE[session_name()]) {
setcookie(session_name(), '', time()-42000, '/');

if(isset($httpReferer)) {
header("Location: $httpReferer");
} else {
header("Location: http://domain.com/index.php");


I'm not sure how good of a logout script this is but it works perfectly on my remote hosted server. However, it does not work on localhost. It Locates back to httpReferer but the user is still logged in. I'm using xampp. Any help with this or comments about how good, bad, or unnecessary the script is would be greatly appreciated. Thanks



 12:51 am on Aug 2, 2012 (gmt 0)

have you checked to see what cookies are stored by your browser and what cookies are sent with the request?

do you get the same behavior in multiple browsers?

do you have the same problem using the loopback IP address?

brotherhood of LAN

 1:05 am on Aug 2, 2012 (gmt 0)

Also check the actual time being set in the past (as it may be in the future)... this may be an issue if your localhost is in a different timezone to your remote server.

using a plugin like firebug of http live headers would help see what's going on.


 12:56 pm on Aug 2, 2012 (gmt 0)

hi, thanks for your help. I figured out the issue is that i didn't have the correct absolute path to the logout page so when i linked there from localhost it didnt link. wierd i didnt get a page not found error, it just seemed to refresh the page. I installed firebug and http live headers, thanks for the advice. Would you also recommend phpfire?

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved