Re: Error en autenticacion!

From: Date: Thu, 12 Jul 2001 07:20:04 +0000
Subject: Re: Error en autenticacion!
References: 1 2  Groups: php.general.es 
Request: Send a blank email to general-es+get-12212@lists.php.net to get a copy of this message
HOla: " header("WWW-Authenticate: Basic realm=\"prueba\""); header("HTTP/1.0 401 Unauthorized"); " esto envia un mensaje de cabecera; estos mensajes sólo pueden ser enviados antes de reslizar cualquier output Incluido el "<html>". Debes poner la funcion autentifica antes de hacer ninun echo en tu escript. ******************************** Jaime Abeledo CEO - mAs impacto networks Avda/ García Barbón, 90 - 2ª planta - oficina i 36201 VIGO T 986112425 - F 986112426 ************************************************************** http://www.masimpacto.com ----- Original Message ----- From: "Alfredo Lupe C." <alctti@bcb.gov.bo> To: <lista@phpes.com> Sent: Wednesday, July 11, 2001 10:50 PM Subject: [PHP-ES] Error en autenticacion! 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

« previous php.general.es (#12212) next »