My program is launching a dialog box to prompt for the user name and password. However, these variables aren't being set.
This is the code:
<?php
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header(' Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Text to send if user hits Cancel button';
// next 3 lines added to display values
echo "<P>Remote User:{$_SERVER['REMOTE_USER']}</p>";
echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>";
exit;
} else {
echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>";
}
?>
It is producing the following output:
"Text to send if user hits Cancel button
Remote User:
Hello .
You entered as your password."
I am using PHP 4.3.10 with the following settings:
Register globals is on
Safemode is off
I would be very grateful for any advice as this is driving me insane!
Thanks,
Tim
This is the code:
<?php
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header(' Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Text to send if user hits Cancel button';
// next 3 lines added to display values
echo "<P>Remote User:{$_SERVER['REMOTE_USER']}</p>";
echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>";
exit;
} else {
echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>";
}
?>
It is producing the following output:
"Text to send if user hits Cancel button
Remote User:
Hello .
You entered as your password."
I am using PHP 4.3.10 with the following settings:
Register globals is on
Safemode is off
I would be very grateful for any advice as this is driving me insane!
Thanks,
Tim