Re: PHP_AUTH_USER
| From: | Hendråwan Rinäldi | Date: | Sat, 31 Aug 2002 03:10:55 +0000 |
| Subject: | Re: PHP_AUTH_USER | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-114749@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: "Liam MacKenzie" <phplist@operationenigma.com>
To: "Hendråwan Rinäldi" <webby@rori.org>; <php-general@lists.php.net>
Sent: Friday, August 30, 2002 4:49 PM
Subject: Re: [PHP] PHP_AUTH_USER
> I'm afraid you're going to have to be more specific than that my friend.
>
every body or my buddy Liam MacKenzie can help me??
this is the script....
what is the code for log out?????
thankssssssssssssssssss
:))))
<?
if(!isset($PHP_AUTH_USER))
Header("WWW-authenticate: basic realm=\"Login Required\"");
Header("HTTP/1.0 401 Unauthorized");
$title="Login screen";
?>
Contact the webmaster
<?
exit;
} else
mysql_pconnect("host","user","password") or die("Unable to
connect to SQL
server");
mysql_select_db("database_here") or die("Unable to select database");
$user_id=strtolower($PHP_AUTH_USER);
$password=$PHP_AUTH_PW;
$query = mysql_query("select * from users where username='$user_id' and
password=password('$password')");
if(!mysql_num_rows($query))
Header("WWW-authenticate: basic realm=\"Auth Required\"");
Header("HTTP/1.0 401 Unauthorized");
$title="Login Instructions";
?>
Username and Password are required to view this page.<br>
<br>
Contact the webmaster
<br>
<?
exit;
}
}
?>