Can anybody tell me why my Authentication.php script does not work on my local machine but works fine on my server. Is there a setting in the php.ini file that needs to be set?
I use PHP ver 4.3.4 with Apache
Here is my code:
<?php
$authorized = FALSE;
// Check for authentication submission.
if ( (isset($SERVER['PHP_AUTH_USER']) AND isset($SERVER['PHP_AUTH_PW'])) ) {
if ( ($_SERVER['PHP_AUTH_USER'] == 'name') AND ($_SERVER['PHP_AUTH_PW'] == 'password') ) { // If the correct values were entered...
$authorized = TRUE;
}
}
// If they haven't been authorized, create the pop-up window.
if (!$authorized) {
header('WWW-Authenticate: Basic realm="Administration Login"');
header('HTTP/1.0 401 Unauthorized'); // For cancellations.
}
?>