Error en autenticacion!
| From: | Alfredo Lupe C. | Date: | Wed, 11 Jul 2001 20:50:49 +0000 |
| Subject: | Error en autenticacion! | ||
| References: | 1 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-12197@lists.php.net to get a copy of this message | ||
Estimados amigos,
Sigo la lista con mucho interes. Estoy empezando a programar con PHP y ahora
tengo un problema que no se por qué sucede. He buscado en el manual pero no
me aclara nada.
El codigo es el siguiente:
<?php
function authenticate(){
header("WWW-Authenticate: Basic realm=\"prueba\"");
header("HTTP/1.0 401 Unauthorized");
echo "You must enter a valid login ID and password to access this resource\n";
exit;
}
if(!isset($PHP_AUTH_USER) || ($SeenBefore == 1 && !strcmp($OldAuth, $PHP_AUTH_USER)) ) {
authenticate();
}
else {
echo "</p>Welcome: $PHP_AUTH_USER<br>";
echo "Old: $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";
}
?>
Y cuando llamo a la pagina desde el browser me lanza el siguiente warning:
Warning: Cannot add header information - headers already sent by (output started at /usr/apache/htdocs/uno.php:8) in /usr/apache/htdocs/uno.php on line 10
Warning: Cannot add header information - headers already sent by (output started at /usr/apache/htdocs/uno.php:8) in /usr/apache/htdocs/uno.php on line 11
You must enter a valid login ID and password to access this resource
Si alguno sabe, por favor una explicación y que se debe hacer para arreglarlo.
Gracias
Alfredo Lupe
La Paz - Bolivia