Reply to Help!!! Cannot do Authentication

Your name:

Reply:


Posted by K.S. Tang on 05/12/05 19:27

I have a page using the Basic HTTP Authentication and works well before.
But this night, the server seems to not receiving any $_SERVER pass in from
Web browsers.

if ( (!isset($_SERVER['PHP_AUTH_USER'])) || ($_SERVER['PHP_AUTH_USER'] !=
"netop") || ($_SERVER['PHP_AUTH_PW'] != "cti63") ) {
header('WWW-Authenticate: Basic realm="Please enter User Name and
Password:"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authentication error!!';
exit;
}

I've trial to put this on another server, it doesn't work too !! (but it
works before also).

I've trial to use the most simple code from php.net

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>";
}

But it doesn't work too. The browser ask for the user name and password for
three times and than echo the line "Text to send if user hits......."

Please !!! Please help me.
Thanks a lot.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация