Beginner Authentication Tutorial Question.

From: Christopher Richards (
Date: 02/19/05

Date: Sat, 19 Feb 2005 20:55:59 GMT

Why isn't this working? I copied this from

So if both $PHP_AUTH_USER and $PHP_AUTH_PW are not set then I should get the
Authorization Required message (which I do) but putting anything into the
authentication box should set these global variables (if I understand
correctly) then why, when I type anything into the authentication fields am
I never getting the success message?Thanks.

if((!isset($PHP_AUTH_USER)) || (!isset($PHP_AUTH_PW))){
header( 'WWW-Authenticate: Basic realm="Private"');
header( 'HTTP/1.0 401 Unauthorized' );
echo 'Authorization Required.';



echo "success";