User Authentication
| From: | Amer Alhabsi | Date: | Tue, 27 Feb 2001 06:42:24 +0000 |
| Subject: | User Authentication | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-41801@lists.php.net to get a copy of this message | ||
Hi,
I'm trying to use an authentication method I found in a tutorial in the
net. The server prompts for username/password. But if I enter the hard coded
values (or any other values) the server rejects them with a message
authorization failed.
I use PHP 4 as a module on IIS
Thanks very much for any help,
here is the program I got from the tutorial.
<?php
if ( ( !isset( $PHP_AUTH_USER )) || (!isset($PHP_AUTH_PW))
|| ( $PHP_AUTH_USER != 'user' ) || ( $PHP_AUTH_PW != 'open' ) )
header( 'WWW-Authenticate: Basic realm="Private"' );
header( 'HTTP/1.0 401 Unauthorized' );
echo 'Authorization Required.';
exit;
} else
echo 'Success!';
}
?>