note 96178 added to features.http-auth
| From: | jakefree at verizon dot net | Date: | Fri, 12 Feb 2010 16:32:01 +0000 |
| Subject: | note 96178 added to features.http-auth | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-165910@lists.php.net to get a copy of this message | ||
Example 1 is utterly useless. All it would do is force the browser's atuhentication box to show
but all anyone would have to do is just enter any string for a username and they will be let in.
try this:
<?php
define("PHP_AUTH_USER", "username");
define("PHP_AUTH_PW", "password");
//if (!isset($_SERVER['PHP_AUTH_USER']))
if ($_SERVER['PHP_AUTH_USER'] != PHP_AUTH_USER || $_SERVER['PHP_AUTH_PW'] !=
PHP_AUTH_PW )
{
header('WWW-Authenticate: Basic realm="Customer Management"');
header('HTTP/1.0 401 Unauthorized');
echo 'You need to login with proper username and password to gain access to this
page';
exit;
}
else
{
$welcomeMessage = "<h3>Hello , welcome to the Customer Management
Suite</h3>";
}
?>
----
Server IP: 64.71.164.2
Probable Submitter: 96.228.118.157
----
Manual Page -- http://www.php.net/manual/en/features.http-auth.php
Edit -- https://master.php.net/note/edit/96178
Del: integrated -- https://master.php.net/note/delete/96178/integrated
Del: useless -- https://master.php.net/note/delete/96178/useless
Del: bad code -- https://master.php.net/note/delete/96178/bad+code
Del: spam -- https://master.php.net/note/delete/96178/spam
Del: non-english -- https://master.php.net/note/delete/96178/non-english
Del: in docs -- https://master.php.net/note/delete/96178/in+docs
Del: other reasons-- https://master.php.net/note/delete/96178
Reject -- https://master.php.net/note/reject/96178
Search -- https://master.php.net/manage/user-notes.php