I am trying to initiate user authentication by validating username/password using a database. What I would like to do is have a user log in on the home page and if the user is validated then he/she will be redirected to a private page. I would also like to protect this private page in case someone would like to access it directly by typing in the url. It seems to be working in Netscape but not in Internet Explorer. When someone tries to log in with the appropriate password and username from the home page, it appears that Internet explorer is not reading the $PHP_AUTH_USER & PW variables and therefore brings up the authroization dialog box. This is not the case in Netscape Explorer. Below you'll find my code for the password/protected page.
Thanks.
if(isset($PHP_AUTH_USER)&& isset($PHP_AUTH_PW))
{
$db=pg_connect("dbname=test user=test password=test");
$query="select * from users where
username='PHP_AUTH_USER' and password='$PHP_AUTH_PW'";
$result=pg_exec($db,$query);
if(!pg_numrows($result))
{
Let them view my page
}
else
{
header('WWW-Authenticate: Basic realm="Private"');
header('HTTP/1.0 401 Unauthorized.');
echo 'Authorization Required';
exit;
}