Welcome to WebmasterWorld Guest from 50.16.24.12

Forum Moderators: coopster & jatar k

logout script not working on localhost

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



I have a logout script like this:


<?php
require 'core.php';

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

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)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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?
(http://127.0.0.1/)
1:05 am on Aug 2, 2012 (gmt 0)

WebmasterWorld Administrator brotherhood_of_lan is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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?
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month

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