Sobre $PHP_AUTH_USER
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:FoxServwwwProDirPruebaSesion.php:2) in C:FoxServwwwProDirPruebaSesion.php on line 4
Warning: Cannot add header information - headers already sent by (output started at C:FoxServwwwProDirPruebaSesion.php:2) in C:FoxServwwwProDirPruebaSesion.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
******************************************************************************
<?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:FoxServwwwProDirPruebaSesion.php:2) in C:FoxServwwwProDirPruebaSesion.php on line 4
Warning: Cannot add header information - headers already sent by (output started at C:FoxServwwwProDirPruebaSesion.php:2) in C:FoxServwwwProDirPruebaSesion.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
