Forum » Izdelava spletišč » User authentication + PHP + IIS
User authentication + PHP + IIS
kuntek ::
Zakaj ne morem delat z user authentication v PHPju na IIS??? Nonstop mi javlja neke errorje. PHP na IIS poganjam kot module (z php4isapi.dll) in ne kot CGI. Za začetek sem probal tole kodo: 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 buttonn";
exit;
} else {
echo "
echo "
}
?>
Koda je direktno iz manuala!
header("WWW-Authenticate: Basic realm="My Realm"");
header("HTTP/1.0 401 Unauthorized");
echo "Text to send if user hits Cancel buttonn";
exit;
} else {
echo "
Hello {$_SERVER['PHP_AUTH_USER']}.
";echo "
You entered {$_SERVER['$PHP_AUTH_PW']} as your password.
";}
?>
Koda je direktno iz manuala!
- spremenil: kuntek ()
kuntek ::
Warning: Cannot add header information - headers already sent by (output started at c:\inetpub\wwwroot\test.php:6) in c:\inetpub\wwwroot\test.php on line 8
Warning: Cannot add header information - headers already sent by (output started at c:\inetpub\wwwroot\test.php:6) in c:\inetpub\wwwroot\test.php on line 9
Warning: Cannot add header information - headers already sent by (output started at c:\inetpub\wwwroot\test.php:6) in c:\inetpub\wwwroot\test.php on line 9
darh ::
pred funkcijo header(); NE sme biti nikakršnega outputa.. tud nove vrstice ne... nič...
Seveda, če bi si prebral v manualu kaj, bi to vedu...
Seveda, če bi si prebral v manualu kaj, bi to vedu...
Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.
Excuses are useless! Results are priceless!
Vredno ogleda ...
Tema | Ogledi | Zadnje sporočilo | |
---|---|---|---|
Tema | Ogledi | Zadnje sporočilo | |
» | iis 7 in dll datotekeOddelek: Izdelava spletišč | 657 (591) | Neon87 |
» | phpBB forum; a dela na IIS?Oddelek: Programska oprema | 1986 (1715) | boych |
» | IIS in Apache na enem računalnikuOddelek: Izdelava spletišč | 1269 (1193) | webfreak |
» | Katera web galerija (že narejena ali tista za IIS)Oddelek: Izdelava spletišč | 1222 (1141) | andrej |
» | PHP problemOddelek: Izdelava spletišč | 869 (756) | Matri[X] |