Page 1 of 1

$PHP_AUTH_USER

Posted: Sun Sep 07, 2008 1:14 am
by jcarlosmc
hi everyone,

I cannot get access granted with this code can someone please help me.

<?php // Manual de PHP
if (($PHP_AUTH_USER!="Joe") || ($PHP_AUTH_PW!="123")) {
header('WWW-Authenticate: Basic realm="Acceso restringido"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authorization Required.';
exit;
}
?>
<!-- Manual de PHP -->
<html>
<head>
<title>Ejemplo de PHP</title>
</head>
<body>
Ha conseguido el acceso a la <B>zona restringida</B>.[/color]
</body>
</html>

http://www.milenioveracruz.com.mx/test2.php

Re: $PHP_AUTH_USER

Posted: Sun Sep 07, 2008 1:17 am
by s.dot
use $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW']