Page 1 of 1

Autenticate/UnAuthenticate Problem

Posted: Wed Dec 03, 2003 4:54 am
by Luis Almeida
Hi all,

I use something like the follwoing script to autenticate a user.
I works fine for autentication.
My problem is : How to UNAuthenticate (using a button or a link) in order to enable another user to autenticate himself whitout having to close the browser:

Code: Select all

<?php
$login = "username";
$password = "password";

function error ($error_message) {
	echo $error_message."<BR>";
	exit;
}

if ( (!isset($PHP_AUTH_USER)) || ! (($PHP_AUTH_USER == $login) && ( $PHP_AUTH_PW == "$password" )) ) {
	header("WWW-Authenticate: Basic enter="Secured Area"");
	header("HTTP/1.0 401 Unauthorized");
	error("You are not authorized!");
}

?>
thank“s in advance

Posted: Wed Dec 03, 2003 7:17 am
by mchaggis
This is mainly an IE problem... But usually just issuing the following, makes the browser forget who you are, but as I say, IE doesn't seem to like it, well it tells u youve logged out but then remembers the old username and password

Code: Select all

header("HTTP/1.0 401 Unauthorized");