Im just trying to get the pop-up box and input the correct user name and password then get a response saying I am authorized etc. But no matter what I try it will not continue through the program after a certain point for me to get the authorized response. So I am wondering if maybe there is something that my Apache2 has to have enabled or my php-4.3.4 ??
Anyone know why I am failing? The pop-up window comes up fine but it wont accept anything i enter.
<?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 != "test") || ($PHP_AUTH_PW != "test123")) {
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>
";
}
}
?>