Jump to content


logout script help


3 replies to this topic

#1 adm

    Young Padawan

  • Members
  • Pip
  • 19 posts
  • Location:Indiana
  • Interests:Messing up html. =D

Posted 19 March 2008 - 08:33 PM

Hi, I'm having a bit of a problem with my logout script...

<?

// logout page


// destroy session

session_start();
session_unset();
session_destroy();



// destroy the cookies

setcookie('username', "", time() - 60 * 60 * 24 * 7);
setcookie('auth', "", time() - 60 * 60 * 24 * 7);

// redirect

header('Location:http://www.lozltov.com/');die();


$title = "LozltoV > Members > Logout";
require ($_SERVER['DOCUMENT_ROOT'] . '/inc/html_header.php');




echo "<div id=\"menu\">";
include($_SERVER['DOCUMENT_ROOT'] . '/inc/login_form.php');
include($_SERVER['DOCUMENT_ROOT'] . '/inc/user_nav.php');
include($_SERVER['DOCUMENT_ROOT'] . '/inc/google_ad.php');
echo "</div>";


echo "<div id=\"content\">";

echo "</div>";




require ($_SERVER['DOCUMENT_ROOT'] . '/inc/html_footer.php');


?>

When I'm logged into the site, I'll go to the page and It wont delete the cookies or destroy my session (ie. it doesn't work). Any help would be much appreciated :)

#2 BigDog

    Young Padawan

  • Members
  • Pip
  • 277 posts
  • Gender:Male
  • Location:Orange County, California
  • Interests:Running, building computers, PC games and BMX and programming.

Posted 19 March 2008 - 09:04 PM

I'm not sure what unset for sessions does, so maybe try removing that and seeing if sessions get deleted.

Also, in the past, i've ran into problems when doing 60 * 60 * 24 * 7 for cookie time.


Just do:

setcookie('username', "", time() - 604800);


#3 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 19 March 2008 - 10:45 PM

http://php.net/manua...ion-destroy.php

Read that. Should answer some questions (for both of you).

#4 adm

    Young Padawan

  • Members
  • Pip
  • 19 posts
  • Location:Indiana
  • Interests:Messing up html. =D

Posted 20 March 2008 - 02:24 PM

Thanks for the comments guys, but I still can't seem to fix the script and I don't understand why the code I posted originally does not work.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users