note 22057 added to features.http-auth

From: Date: Wed, 05 Jun 2002 06:08:01 +0000
Subject: note 22057 added to features.http-auth
Groups: php.notes 
Request: Send a blank email to php-notes+get-31477@lists.php.net to get a copy of this message
A more elegant way to force a new name/password, cf. example 17-2 (if you don't mind passing the old user in the query string): <? if (isset($PHP_AUTH_USER)) { if (!isset($prev_user)) { header("Location: http://$HTTP_HOST$PHP_SELF?prev_user=$PHP_AUTH_USER"); exit; } else { if ($PHP_AUTH_USER == $prev_user) { header('WWW-Authenticate: Basic realm="Secure"'); header('HTTP/1.0 401 Unauthorized'); exit; } } } else { header('WWW-Authenticate: Basic realm="Secure"'); header('HTTP/1.0 401 Unauthorized'); exit; } ?> The final set of headers is necessary because some browsers seem to unset $PHP_AUTH_USER when the location header is sent. -- http://www.php.net/manual/en/features.http-auth.php http://master.php.net/manage/user-notes.php?action=edit+22057 http://master.php.net/manage/user-notes.php?action=delete+22057 http://master.php.net/manage/user-notes.php?action=reject+22057

« previous php.notes (#31477) next »