Help! authorization question...

From: Date: Thu, 13 Jun 2002 14:37:02 +0000
Subject: Help! authorization question...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-101967@lists.php.net to get a copy of this message
Hello, I am new to PHP and trying to learn. I am trying a tutorial and this is the script. It is supposed to pop up a box requiring a username and pass. but all I get is 'Authorization Required' Any suggestions? I am running PHP3 and 4 and on an IIS server (it is just for testing, normally it would be apache) Thanks in advance!!! <?php // File Name: auth02.php // Check to see if $PHP_AUTH_USER already contains info if (!isset($PHP_AUTH_USER)) { // If empty, send header causing dialog box to appear header('WWW-Authenticate: Basic realm="My Private Stuff"'); header('HTTP/1.0 401 Unauthorized'); echo 'Authorization Required.'; exit; } else if (isset($PHP_AUTH_USER)) { if (($PHP_AUTH_USER != "admin") || ($PHP_AUTH_PW != "abc123")) { header('WWW-Authenticate: Basic realm="My Private Stuff"'); header('HTTP/1.0 401 Unauthorized'); echo 'Authorization Required.'; exit; } else { echo " <P>You're authorized!</p> "; } } ?>

« previous php.general (#101967) next »