View Single Post
Old Feb 17th, 2006, 11:43 AM   #1
anarki
Newbie
 
Join Date: Oct 2005
Posts: 5
Rep Power: 0 anarki is on a distinguished road
http auth logout

Hi, here i am with another question ...
This time http auth, more specific the logout of an applicacion logged by this code:

$auth = false;

if (isset($_SERVER['PHP_AUTH_USER']) &&
isset($_SERVER['PHP_AUTH_PW'])) {

$username = $_SERVER['PHP_AUTH_USER'];
$password = $_SERVER['PHP_AUTH_PW'];
$oMember->Set('username', $username);
$oMember->Set('password', $password);

$results = $oMember->SearchUser();
$number = count($results);
if($number != 0) {
$auth = true;
}
}
if(!$auth) {
header('WWW-Authenticate: Basic realm="My Auth"');
header( 'HTTP/1.0 401 Unauthorized' );
echo 'Authorization Required.';
exit;
}
else {
echo 'Welcome ...';
$_SESSION['member_username'] = $username;
$_SESSION['member_password'] = $password;
echo "<meta http-equiv=\"Refresh\"content=\"2; URL=index.php?order=title\">";
}

I cant make a working code for logout.
In my best approachs the login windows appears again on the screen and when i hit enter the user loggout.
The other approach that i am using rigth now is a javascript function who closes the browser.

I need a clean logout for my users, any help will be appreciated.

Thanx.
anarki is offline   Reply With Quote