Autenticate/UnAuthenticate Problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Luis Almeida
Forum Commoner
Posts: 33
Joined: Tue Apr 01, 2003 4:22 am

Autenticate/UnAuthenticate Problem

Post 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
User avatar
mchaggis
Forum Contributor
Posts: 150
Joined: Mon Mar 24, 2003 10:31 am
Location: UK

Post 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");
Post Reply