www.webdeveloper.com
Results 1 to 2 of 2

Thread: "How do I log out from HTTP authentication?"

  1. #1
    Join Date
    Jul 2003
    Posts
    69

    "How do I log out from HTTP authentication?"

    Hi there....

    I used UNIX htaccess for Log in to my web page. Inside my code I use MYSQL with PHP but everytime I closed the seeion for MYSQL.

    Now my goal is to logo out from unix server and once I do that no matter how many same web page I have open will be logged out or inactive as for example in hotmail accout if you do log out once you cannot have access for the other hotmail window if there is any open one. I am using following code but it's not working. Please have a look and help me.....

    Thank you.
    PHP Code:
    <html> 
    <head> 
    <title> 
    </title> 
    </head> 
    <body> 
    <?php 
    function logoutFromHTTP() 

    unset(
    $_SERVER['PHP_AUTH_USER']); 
    unset(
    $_SERVER['PHP_AUTH_PW']); 



    logoutFromHTTP(); 

    print 
    "Logout Successfull"
    ?> 
    </body> 
    </html>

  2. #2
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    First of all, this is a PHP question, so I moved it to the PHP section.

    With PHP Authentication, users are logged out when the browser receives a 401 error, so you shoud be able to log them out with code something like this:

    PHP Code:
    header("WWW-Authenticate: Basic realm=\"My Realm\"");
    header('status: 401 Unauthorized'); 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles