salve,
ho inserito questo script php per creare una autenticazione per una pagina web:
<?php
if(!isset($PHP_AUTH_USER))
{
Header("WWW-Authenticate: Basic realm=\"Xavier Protection\"");
Header("HTTP/1.0 401 Unauthorized");
echo "Text to send if user hits Cancel button\n";
exit;
}
else
{
$user_passwords = array (
"user1" => "password1",
"user2" => "password2",
"user3" => "password3",
"user4" => "password4"
);
if (($PHP_AUTH_USER == "") || ($PHP_AUTH_PW == ""))
{
Header("HTTP/1.0 401 Unauthorized");
echo "Sorry, could find your password!";
exit;
}
else if (strcmp($user_passwords[$PHP_AUTH_USER],$PHP_AUTH_PW) == 0)
{
echo "This is the password protected page.";
exit;
}
else
{
Header("HTTP/1.0 401 Unauthorized");
echo "Sorry, could find your password!";
exit;
}
}
?>
ma mi da questo errore:
Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\studenti.php:30) in C:\Program Files\Apache Group\Apache2\htdocs\studenti.php on line 33
Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\studenti.php:30) in C:\Program Files\Apache Group\Apache2\htdocs\studenti.php on line 34
Text to send if user hits Cancel button
ho smanettato per un pò ma non sono riuscito a trovare una soluzione...sapreste aiutarmi?