Page 1 of 1

Log out problem from a website ???

Posted: Sun Jul 20, 2003 9:33 am
by szms
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.

Code: Select all

<html>
<head>
<title>
</title>
</head>
<body>
<?php
function logoutFromHTTP()
&#123;
unset($_SERVER&#1111;'PHP_AUTH_USER']);
unset($_SERVER&#1111;'PHP_AUTH_PW']);
&#125;


logoutFromHTTP();

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

Posted: Sun Jul 20, 2003 11:09 am
by Stoker
the use of a .htaccess file is an Apache (web server) feature, not UNIX.

HTTP authentication is the web browser sending the user/pass to the webserver for every single page request, and PHP can not alter this. Changing anything in $_SERVER is meaningless since the webserver never reads anything from it, it is only written to by PHP from the webserver environment variables before the script execution starts.

Some apps do have workarounds, such as Neomail, I dont know exactly what they do but I assume sending some specific headers to the client, but, this only works for a few browsers such as IE, it does not work for Mozilla/Netscape..