Connecting Tech Pros Worldwide Help | Site Map

Turn on $_SERVER["PHP_AUTH_USER"] locally?

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 01:30 PM
jerrygarciuh
Guest
 
Posts: n/a
Default Turn on $_SERVER["PHP_AUTH_USER"] locally?

Hello,

I am finding that on a new server where I am developing

$_SERVER["PHP_AUTH_USER"] and
$_SERVER["PHP_AUTH_PW"]

Do not show up in $_SERVER when I when they should be defined I test
using
print_r($_SERVER) or this

<?php
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Text to send if user hits Cancel button';
exit;
} else {
echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your
password.</p>";
}
?>

Is there a setting that is keeping PHP from accessing this
information? Can I set this locally?

$_SERVER["REMOTE_USER"] also stays empty.

TIA for any advice!

jg



  #2  
Old July 17th, 2005, 01:30 PM
jerrygarciuh
Guest
 
Posts: n/a
Default Re: Turn on $_SERVER["PHP_AUTH_USER"] locally?

I should add that if I add an .htaccess to a folder requiring username "dm"
and password "whatever" and then

do this

<?php
echo 'PHP_AUTH_USER =' . $_SERVER['PHP_AUTH_USER'] . '<br>';
echo 'PHP_AUTH_PW =' . $_SERVER['PHP_AUTH_PW'] . '<br>';
echo 'REMOTE_USER =' . $_SERVER['REMOTE_USER'] . '<br>';
?>


I get this:

PHP_AUTH_USER =
PHP_AUTH_PW =
REMOTE_USER =dm

so REMOTE_USER is defined but no :password.

jg


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.