webForumDet fria alternativet

$PHP_AUTH osv.

4 svar · 156 visningar · startad av oelbal

oelbalMedlem sedan jan. 20013 016 inlägg
#1

Försökte testa att göra en simpel inloggningsruta idag, men det verkar inte fungera. Mitt Win2K bara loopar rutan hela tiden, den verkar inte vilja acceptera värdena. Vad har jag gjort för fel?

<?
if (!isset($PHP_AUTH_USER) &#0124;&#0124; !isset($PHP_AUTH_PW))
{
  header('WWW-Authenticate: Basic realm="Private"');
  header('HTTP/1.0 401 Unauthorized');
  exit;
}
else
{
  echo("Du skrev $PHP_AUTH_USER och $PHP_AUTH_PW");
}
?>
cmkMedlem sedan mars 2001305 inlägg
#2

I manualen kan man läsa:

The HTTP Authentication hooks in PHP are only available when it is running as an Apache module and is hence not available in the CGI version. In an Apache module PHP script, it is possible to use the header() function to send an "Authentication Required" message to the client browser causing it to pop up a Username/Password input window. Once the user has filled in a username and a password, the URL containing the PHP script will be called again with the variables, $PHP_AUTH_USER, $PHP_AUTH_PW and $PHP_AUTH_TYPE set to the user name, password and authentication type respectively. Only "Basic" authentication is supported at this point. See the header() function for more information.

/Marty

------------------
Keep on rocking 24-7

oelbalMedlem sedan jan. 20013 016 inlägg
#3

Misstänkte det, men tack iaf!

OlleBoopMedlem sedan feb. 20001 432 inlägg
#4

Har du provat att köra PHP som ISAPI-modul?

oelbalMedlem sedan jan. 20013 016 inlägg
#5

Jag kör PHP om ISAPI-modul nu...

Genererad på 531 ms · cache AV · v20260730165559-full.f96bc7eb