Http authentication, Win 2k, IIS 5 - Mac IE problem
Posted: Tue Jun 29, 2004 2:51 am
Hi all,
I have the following code that works fine for IE on windowsand also with Safari & Netscape on Mac.
The problem is IE on the mac. If I were to navigate to a page with the below code it asks for authentication which is good. If I were to follow a link to another page also using the same code it asks to reauthenticate.
Im scratching my head with this one. Could someone please advise.
I have the following code that works fine for IE on windowsand also with Safari & Netscape on Mac.
The problem is IE on the mac. If I were to navigate to a page with the below code it asks for authentication which is good. If I were to follow a link to another page also using the same code it asks to reauthenticate.
Im scratching my head with this one. Could someone please advise.
Code: Select all
<html>
<?
/* Check for values in $PHP_AUTH_USER and $PHP_AUTH_PW */
if ((!isset($_SERVERї'PHP_AUTH_USER'])) || (!isset($_SERVERї'PHP_AUTH_PW']))) {
/* No values: send headers causing dialog box to appear */
header('WWW-Authenticate: Basic realm="Private"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authorization Required.';
exit;
} else if ((isset($_SERVERї'PHP_AUTH_USER'])) && (isset($_SERVERї'PHP_AUTH_PW']))){
/* Values contain some values, so check to see if theyre correct */
if (($_SERVERї'PHP_AUTH_USER'] != "myuser") || ($_SERVERї'PHP_AUTH_PW'] != "mypassword")) {
/* If either the username entered is incorrect, or the password entered is incorrect, send the headers causing dialog box to appear */
header('WWW-Authenticate: Basic realm="Private"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authorization Required.';
exit;
} else if (($_SERVERї'PHP_AUTH_USER'] == "myuser") || ($_SERVERї'PHP_AUTH_PW'] == "mypassword")) {
/* if both values are correct, print success message */
//My web page omitted from here for readability.
}
}
?>
</html>