Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dialog box goes not return user name and password

Status
Not open for further replies.

crossland

Programmer
Joined
Oct 26, 2001
Messages
10
Location
GB
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
 
are you using apache with php as a server module?
 
PHP is run as CGI not a Module.
 
the php documentation states
The HTTP Authentication hooks in PHP are only available when it is running as an Apache module and is hence not available in the CGI version.

that'd be your problem then!

 
doh!

Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top