PHP - Sobre $PHP_AUTH_USER

 
Vista:

Sobre $PHP_AUTH_USER

Publicado por Cristopher!! (1 intervención) el 10/07/2004 23:16:24
He intentado usar el código:
******************************************************************************
<?php // Manual de PHP de WebEstilo.com
if (!isset($PHP_AUTH_USER)) {
header('WWW-Authenticate: Basic realm="Acceso restringido"');
header('HTTP/1.0 401 Unauthorized');

echo 'Authorization Required.';
exit;
}
else {
echo "Ha introducido el nombre de usuario: $PHP_AUTH_USER<br>";
echo "Ha introducido la contraseña: $PHP_AUTH_PW<br>";
}
?>
***********************************************************************************

Pero no me funciona, el servidor me tira el siguiente mensaje de error:
*************************************************************************************
Warning: Cannot add header information - headers already sent by (output started at C:\FoxServ\www\ProDir\PruebaSesion.php:2) in C:\FoxServ\www\ProDir\PruebaSesion.php on line 4

Warning: Cannot add header information - headers already sent by (output started at C:\FoxServ\www\ProDir\PruebaSesion.php:2) in C:\FoxServ\www\ProDir\PruebaSesion.php on line 5

***********************************************************************************
Utilizo el FoxServ y me parece que hay que cambiar algo en la configuración de archivo php.ini pero no recuerdo exactamente que. Estoy un poco desesperado, así que ruego que alguien que conosca como solucionar el problema me ayude
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder