Ho fatto come mi hai detto tu:
codice:
<?php
//
// Copyright 2001 Xavier Media Group
// http://www.xaviermedia.com/php/
//
// If you need help or have suggestions, please visit
// http://www.xaviermedia.com/forum/index.php or
// http://www.xaviermedia.com/php/password.phtml
//
if(!isset($PHP_AUTH_USER))
{
Header("WWW-Authenticate: Basic realm=\"Xavier Protection\"");
Header("HTTP/1.0 401 Unauthorized");
echo "Text to send if user hits Cancel button\n";
exit;
}
else
{
$user_passwords = array (
// user1 is the login name and password1
// is that users password. Add as many
// lines as you like.
"user1" => "password1",
"user2" => "password2",
"user3" => "password3",
"user4" => "password4"
);
if (($_SERVER['PHP_AUTH_USER'] == "") || ($_SERVER['PHP_AUTH_PW'] == ""))
{
Header("HTTP/1.0 401 Unauthorized");
echo "Sorry, could find your password!";
exit;
}
else if (strcmp($user_passwords $_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW'] ) == 0)
{
// This is the page that should be password protected.
echo "This is the password protected page.";
exit;
}
else
{
Header("HTTP/1.0 401 Unauthorized");
echo "Sorry, could find your password!";
exit;
}
}
?>
Ma mi da questo errore:
Parse error: parse error, unexpected T_VARIABLE in /xxxx/xxxxx/xxxxx.php on line 58
Comunque,sono su altervista
Aiutami,per favore!
Ciao e grazie in anticipo