This only works if PHP is installed as an Apache module on the Linux/UNIX platforms.
>From the docs: One additional note about PHP: if PHP is installed as an Apache module on the Linux/UNIX platforms, there are additional global variables available to your PHP script: $PHP_AUTH_USER -- Authenticated User name $PHP_AUTH_PW -- Authenticated Password $PHP_AUTH_TYPE -- Authentication Type Additionally, your PHP program can force Apache to prompt the user for a username and password with the following PHP commands: header('WWW-Authenticate: Basic realm="My Private Stuff"'); header('HTTP/1.0 401 Unauthorized'); echo 'Authorization Required.'; >From then on, your application logic can decide how to respond to the user. Note that on the Windows platform, PHP is installed as a CGI, and these features are therefore not available. > -----Original Message----- > From: GoodFella [mailto:[EMAIL PROTECTED]] > Sent: zondag 6 januari 2002 17:31 > To: php Mail > Subject: [PHP] Internal Server Error? > > > Hello, > > Does anybody have any ideas why the code below is giving me > internal server errors? > > if (!isset($PHP_AUTH_USER)) { > > header('WWW-Authenticate: Basic realm="XYZ Company Admin Area"'); > header('HTTP/1.0 401 Unauthorized'); > echo 'Authorization Required.'; > exit; > > } else if (isset($PHP_AUTH_USER)) { > > if (($PHP_AUTH_USER != "admin") || ($PHP_AUTH_PW != "password")) { > > header('WWW-Authenticate: Basic realm="XYZ Company Admin Area"'); > header('HTTP/1.0 401 Unauthorized'); > echo 'Authorization Required.'; > exit; > > > Do I need to set or change anything in my PHP set-up? > > Thanks in advance, > > GF. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]