By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,313 Members | 1,240 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,313 IT Pros & Developers. It's quick & easy.

Header and Authentification

P: n/a
Hi,

I want use the header authentification (HTTP/PHP module), and i've a
big problem for to get the varaibles 'PHP_AUTH-*".

This is my source code :
---------------------------------------------------------------------------------
<?php
function authentificate() {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Texte utilisť si le visiteur utilise le bouton
d\'annulation';
exit;
}

include("ffrs_mysql-2.inc.php");
$sql = new MyDB();

$userauth =
$sql->getAuthUser($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']);

if ($userauth == ($_SERVER['PHP_AUTH_USER'])) ##
Don't work
(or if ("maxx" == ($_SERVER['PHP_AUTH_USER'])) ##
Work)
{
echo "c bon";
include("adduserAdminForm.php");
print_r ($_SERVER);
}
else
{
authentificate();
}
?>
---------------------------------------------------------------------------------
The window popup authentification don't open and i am going directly on
my page. When i replace "$userauth" by "maxx" for example, the window
popup authentification open with no problem and i can login myself.

Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.