SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Can't log out

Hybrid View

  1. #1
    SitePoint Wizard subnet_rx's Avatar
    Join Date
    Aug 2001
    Location
    Hattiesburg, MS
    Posts
    1,085
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can't log out

    I'm using sessions and a logout.php page when the person wants to log out. Here's the code:

    PHP Code:
      session_start();
      require_once(
    'globalsettings.inc.php');
      require_once(
    'functions.inc.php');
      
    logout();
        
      
    // reroute to calendar home page
      
    redirect2URL("index.php");
      exit; 
    The logout function simply does this:
    PHP Code:
        function logout() {
            unset(
    $_SESSION["AUTH_USERID"]);
            unset(
    $_SESSION["AUTH_SPONSORID"]);
            unset(
    $_SESSION["AUTH_SPONSORNAME"]);
            unset(
    $_SESSION["AUTH_ADMIN"]);
        } 
    This is not working in IE or FF though, and I never get logged out. What is going wrong?

  2. #2
    Worship the Krome kromey's Avatar
    Join Date
    Sep 2006
    Location
    Fairbanks, AK
    Posts
    1,621
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How do you determine whether a user is logged in or not?
    PHP questions? RTFM
    MySQL questions? RTFM

  3. #3
    SitePoint Zealot Servyces's Avatar
    Join Date
    Jun 2007
    Location
    The Netherlands
    Posts
    112
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thy this

    PHP Code:
    <?php
    function logout() {
            if(isset(
    session_id())) {
                unset(
    $_SESSION["AUTH_USERID"]);
                unset(
    $_SESSION["AUTH_SPONSORID"]);
                unset(
    $_SESSION["AUTH_SPONSORNAME"]);
                unset(
    $_SESSION["AUTH_ADMIN"]);
                
    session_destroy();
            } 
    }
    ?>
    Servyces.com
    Where itís all about you.
    Your partner in online solutions.
    Visit our website at http://www.servyces.com/

  4. #4
    SitePoint Wizard wonshikee's Avatar
    Join Date
    Jan 2007
    Posts
    1,223
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    What's the logic behind unsetting 4 _SESSION variables, then destorying the session?

  5. #5
    SitePoint Wizard subnet_rx's Avatar
    Join Date
    Aug 2001
    Location
    Hattiesburg, MS
    Posts
    1,085
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    session_destroy just kept logging me out after I made a certain choice after logging in. I'm not creating my own program, this is a calendar program that is supposed to be a great product, but it hasn't been updated since 2005. So, I can only assume that I can't log out because of my browser (FF 2.0 and IE 7) or because of my server environment (PHP 4.1.2). I'm just trying to fix it to work on our server. This is the first real problem that I have encountered though.


Bookmarks

Posting Permissions

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