Hello,
I have 2 sites and I use the exact same code for both to authenticate a user with HTTP authentication, prompting for a username and password, then querying a DB etc...
It works fine one one site but not the other. The sites are running in two different servers.
When it doesn't work, it just seems like the HTTP authentication prompt window does not take anything that is entered and just pops right back up once OK is clicked.
I don't understand why because I don't think any of the settings are differents on the 2 sites.
Any clue of what could be going on?
Thanks in Advance.
here is the code i used:
<?php
// sample #1 redirect after success
if ( ( !isset($HTTP_SERVER_VARS['$PHP_AUTH_USER'] )) || (!isset($HTTP_SERVER_VARS['$PHP_AUTH_PW']))
|| ( $HTTP_SERVER_VARS['$PHP_AUTH_USER'] != "user" ) || ( $HTTP_SERVER_VARS['$PHP_AUTH_PW'] != "open" ) ) {
header( 'WWW-Authenticate: Basic realm="Private"' );
header( 'HTTP/1.0 401 Unauthorized' );
echo 'Authorization Required.';
exit;
} else {
header( 'Location: [url]http://usersite-1323.websiteforge.com/custom/catalog/customer/home.php[/url]' );
//print "kkkkkkkkkkkk";
}
?>