Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Aug 2005
    Posts
    257
    Thanks
    8
    Thanked 0 Times in 0 Posts

    delete session and cookie

    I have the following code:

    PHP Code:
    if($_GET['logout'] == "true") {
     
    session_start(); 
     unset(
    $_SESSION['the_ID']);
     
    session_unset();
     
    session_destroy();
     unset(
    $_COOKIE['domainp']);  

    But, when I execute the code don't kill the session and don't remove the cookie... Why? Regards

  • #2
    New Coder
    Join Date
    Oct 2006
    Posts
    82
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Have you tried IF(isset($_GET['logout']))? Just in case you haven't actually set 'logout' to equal the string 'true', but only you would know that.

    Not much help sorry

  • #3
    Regular Coder
    Join Date
    Aug 2005
    Posts
    257
    Thanks
    8
    Thanked 0 Times in 0 Posts
    uh? you confuse me more.

  • #4
    ess
    ess is offline
    Regular Coder
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    865
    Thanks
    7
    Thanked 29 Times in 28 Posts
    Yeah...I have seen this problem before. try adding the following to what you have already written.

    PHP Code:
    // to ensure that all session variables have been deleted
    // add the following line.
    $_SESSION = array();

    // to delete the cookie...just set time to past today's date. 
    setcookie(session_name(), ''time()-42000'/'); 
    Good luck.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •