$PHP_AUTH_USER

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jcarlosmc
Forum Newbie
Posts: 1
Joined: Sat Sep 06, 2008 8:54 pm

$PHP_AUTH_USER

Post 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
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Re: $PHP_AUTH_USER

Post by s.dot »

use $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW']
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply