http autentification

http autentification

Posted by: pierre1405
Posted on: 2006-03-15 18:21:00

I try to use this script :

if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="My Realm"');
header('');
echo 'Texte utilisé si le visiteur utilise le bouton d'annulation';
exit;
} else {
echo "<p>Hello, {$_SERVER['PHP_AUTH_USER']}.</p>";
echo "<p>Your password is {$_SERVER['PHP_AUTH_PW']}.</p>";
}


but $_SERVER['PHP_AUTH_USER'] is never set, does someone have an idea???

It's should work, but not with my hosting.

I tried to use htaccess, but it block dynamic download for my flash application, even if I don't forbid linking for file.

Re: http autentification

Posted by: mechanismo
Posted on: 2006-03-21 00:53:00

http authentication hooks don't work when php is being run as a cgi.

to use that script, just open your control panel and uncheck Run PHP as a cgi

Hope that helps

Tags: echoserver phpexithttp