note 21712 added to features.http-auth

From: Date: Thu, 23 May 2002 23:55:53 +0000
Subject: note 21712 added to features.http-auth
Groups: php.notes 
Request: Send a blank email to php-notes+get-30962@lists.php.net to get a copy of this message
If you want to access $PHP_AUTH_USER or $PHP_AUTH_PW variables via the $GLOBALS variable, here is the good path:<p> $GlOBALS[_SERVER][$PHP_AUTH_USER] and $GlOBALS[_SERVER][$PHP_AUTH_PW] <p> In the messages above [_SERVER] was unspecified. <p> This is useful when you want to unset those variables in a function; then your test for the HTTP login prompt would be: <p> if ((!isset($PHP_AUTH_USER)) || ($PHP_AUTH_USER=="") { header("WWW-Authenticate: Basic realm=\"Login process\""); header("HTTP/1.0 401 Unauthorized"); ... } else { if ( =>here test if log/pass are the good one<= ) { ... ok } else { $GLOBALS['_SERVER']['PHP_AUTH_USER'=""; ...error message, user could log again } } -- http://www.php.net/manual/en/features.http-auth.php http://master.php.net/manage/user-notes.php?action=edit+21712 http://master.php.net/manage/user-notes.php?action=delete+21712 http://master.php.net/manage/user-notes.php?action=reject+21712

« previous php.notes (#30962) next »