By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,890 Members | 1,050 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,890 IT Pros & Developers. It's quick & easy.

authentication help

P: n/a
I am using this standard code at the start of my script to request a
user to login. After the user enters information the login box just pops
back up. The script does not move to the else portion after a login is
entered. It just stays in the first part of the if statement. Any help?
if (!isset($PHP_AUTH_USER))
{
header('WWW-Authenticate: Basic realm = "Club"');
header('HTTP/1.0 401 Unauthorized');
echo "Nice try, if you really are supposed to be in here, try again.\n";
exit;
}
else
{
$linkID = @mysql_connect("localhost", "username", "password");
etc....
}

Jul 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Tue, 02 Sep 2003 23:17:58 -0700
"aquilo at hotmail.com" <"aquilo at hotmail.com"> wrote:
I am using this standard code at the start of my script to request a
user to login. After the user enters information the login box just
pops back up. The script does not move to the else portion after a
login is entered. It just stays in the first part of the if statement.
Any help?
if (!isset($PHP_AUTH_USER))
{
header('WWW-Authenticate: Basic realm = "Club"');
header('HTTP/1.0 401 Unauthorized');
echo "Nice try, if you really are supposed to be in here, try
again.\n"; exit;
}
else
{
$linkID = @mysql_connect("localhost", "username", "password");
etc....
}


Prehaps you should try

if (!isset($_SERVER['PHP_AUTH_USER']))

Your php.ini file may have register_globals set to off. A good thing
BTW.
Matt

--
Quispiam Power Computing | "There are two major products that come out
Pendle Hill, Australia | of Berkeley: LSD and UNIX. We don't believe
+61 2 9631 7719 | this to be a coincidence. "
www.quispiam.com | - Jeremy S. Anderson
Jul 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.