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 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2013
    Posts
    68
    Thanks
    19
    Thanked 1 Time in 1 Post

    Unable To Destroy A Session

    I can't seem to destroy the following session that is set when someone logs in.

    PHP Code:
    $session_name 'test';
    $secure false;
    $httponly true
     
    ini_set('session.use_only_cookies'1); 
    $cookieParams session_get_cookie_params();

    session_set_cookie_params($cookieParams["lifetime"], $cookieParams["path"], $cookieParams["domain"], $secure$httponly); 
    session_name($session_name);
    session_start(); 
    session_regenerate_id(true); 
    The logout script I've been using is the following:

    PHP Code:
    session_start();                        
    $_SESSION = array();        
      if(isset(
    $_COOKIE[session_name()])) {
        
    setcookie(session_name(), ''time()-42000'/');
      }        
    setcookie (session_id(), ""time() - 3600);
    session_destroy(); 
    The login script is new but I figured this existing logout script would do the trick but it does nothing to the login session. Anyone have any ideas what's wrong?

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    3,763
    Thanks
    23
    Thanked 548 Times in 547 Posts
    I am scratching my head. Do you want to use sessions or use cookies? Why are you changing your ini file?
    Read this http://www.w3schools.com/php/php_sessions.asp


  •  

    Posting Permissions

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