Foros del Web » Programando para Internet » PHP »

problemas autentificando con $_SERVER['PHP_AUTH_USER']

Estas en el tema de problemas autentificando con $_SERVER['PHP_AUTH_USER'] en el foro de PHP en Foros del Web. tengo el siguiente codigo <?php if (($_SERVER['PHP_AUTH_USER']=="administrador") && ($_SERVER['PHP_AUTH_PW']=="casa")) { Aca la pagina si la autentificacion dio bien... } else { header('WWW-Authenticate: Basic realm="My Realm"'); ...
  #1 (permalink)  
Antiguo 03/08/2005, 17:55
 
Fecha de Ingreso: agosto-2005
Mensajes: 1
Antigüedad: 18 años, 8 meses
Puntos: 0
problemas autentificando con $_SERVER['PHP_AUTH_USER']

tengo el siguiente codigo


<?php
if (($_SERVER['PHP_AUTH_USER']=="administrador") &&
($_SERVER['PHP_AUTH_PW']=="casa")) {

Aca la pagina si la autentificacion dio bien...

} else {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Debe loguearse para poder ingresar';
exit;
}
?>



pero me da el siguiente error

Notice: Undefined index: PHP_AUTH_USER in /cuentas/santotomeonline/www/galerias/index.php on line 2

Warning: Cannot modify header information - headers already sent by (output started at /cuentas/santotomeonline/www/galerias/index.php:2) in /cuentas/santotomeonline/www/galerias/index.php on line 161

Warning: Cannot modify header information - headers already sent by (output started at /cuentas/santotomeonline/www/galerias/index.php:2) in /cuentas/santotomeonline/www/galerias/index.php on line 162
Debe loguearse para poder ingresar


cuando pongo display_errors = Off
en php.ini
anda perfecto

que puede ser?
gracias

Federico
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 14:30.