Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> autoryzacja
Łukasz Sandelews...
post
Post #1





Grupa: Zarejestrowani
Postów: 11
Pomógł: 0
Dołączył: 6.07.2003
Skąd: ślask

Ostrzeżenie: (0%)
-----


chce zrobic autoryzacje na stronie !!!
mam problem !!
po wpisaniu przykladu z manuala :


<html>
<head>
</head>
<body>
<?php
function authenticate() {
header( "WWW-Authenticate: Basic realm="Testowy system autoryzacji"");
header( "HTTP/1.0 401 Unauthorized");
echo "Musisz podać poprawny login i hasło by wejść na tę stronęn";
exit;
}

if(!isset($PHP_AUTH_USER) || ($SeenBefore == 1 && !strcmp($OldAuth, $PHP_AUTH_USER)) ) {
authenticate();
}
else {
echo "</p>Witaj: $PHP_AUTH_USER<br>";
echo "Poprzenio: $OldAuth";
echo "<form action="$PHP_SELF" METHOD=POST>n";
echo "<input type="hidden" name="SeenBefore" value="1">n";
echo "<input type="hidden" name="OldAuth" value="$PHP_AUTH_USER">n";
echo "<input type="submit" value="Re Authenticate">n";
echo "</form></p>n";
}
?>


</body>
</html>


wystepuje taki blad w :


Warning: Cannot add header information - headers already sent by (output started at c:apachehtdocsuwierzytelnianie.php:5)
in c:apachehtdocsuwierzytelnianie.php on line 7

Warning: Cannot add header information - headers already sent by (output started at c:apachehtdocsuwierzytelnianie.php:5)
in c:apachehtdocsuwierzytelnianie.php on line 8
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Łukasz Sandelews...
post
Post #2





Grupa: Zarejestrowani
Postów: 11
Pomógł: 0
Dołączył: 6.07.2003
Skąd: ślask

Ostrzeżenie: (0%)
-----


<?php
function authenticate() {
header( "WWW-Authenticate: Basic realm="Testowy system autoryzacji"");
header( "HTTP/1.0 401 Unauthorized");
echo "Musisz podać poprawny login i hasło by wejść na tę stronęn";
exit;
}

if(!isset($PHP_AUTH_USER) || ($SeenBefore == 1 && !strcmp($OldAuth, $PHP_AUTH_USER)) ) {
authenticate();
}
else {
echo "</p>Witaj: $PHP_AUTH_USER<br>";
echo "Poprzenio: $OldAuth";
echo "<form action="$PHP_SELF" METHOD=POST>n";
echo "<input type="hidden" name="SeenBefore" value="1">n";
echo "<input type="hidden" name="OldAuth" value="$PHP_AUTH_USER">n";
echo "<input type="submit" value="Re Authenticate">n";
echo "</form></p>n";
}
?>

<html>
<head>
</head>
<body>


</body>
</html>

Poczytalem manuala i usunolem wszystkie nieporzebne linie z przed header'a !!
po czym

wystepuje taki blad w :

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

--------------------------------------------------------------------------------

Apache/1.3.23 Server at localhost Port 80


a w pliku error.log
wypisuje takie cos !!

[Sun Jul 20 22:26:38 2003] [error] [client 127.0.0.1] malformed header from script. Bad header=HTTP/1.0 401 Unauthorized: c:/apache/php/php.exe


Pomozcie poczatkujacemu !!!
bo juz wiele nerwow zjadlem z Apachem !!!
a teraz jeszcze to mi wyskakuje !! (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.09.2025 - 19:17