Sto cercando di creare pagine protette tramite autenticazione HTTP.
Il tutto funziona su firefox. Il problema è il dannato ie. Io uso internet explorer 9
Codice PHP:
$utenti = array('user1' => 'abc','user2' => 'ghijkl');
if(!isset($_SERVER['PHP_AUTH_USER']))
{
header( "WWW-Authenticate: Basic realm=\"Autenticazione\"");
header( "HTTP/1.0 401 Unauthorized");
die();
}
else
{
if(!isset($_SERVER['PHP_AUTH_USER']))
{
header( "WWW-Authenticate: Basic realm=\"Autenticazione\"");
header('HTTP/1.1 401 Unauthorized');
die();
}
if($utenti[$_SERVER['PHP_AUTH_USER']] != $_SERVER['PHP_AUTH_PW'])
{
header( "WWW-Authenticate: Basic realm=\"Autenticazione\"");
header('HTTP/1.1 401 Unauthorized');
die();
}
}
14