I need a simple login authentication for my beta site. This is what I found and I put it in my index.php (Joomla 2.5):
<?
//-- login
if ($_SERVER["PHP_AUTH_USER"] != "USERNAME" || $_SERVER["PHP_AUTH_PW"] != "PASSWORD")
{
header("WWW-Authenticate: Basic realm=\"Enter username and password to proceed\"");
header("HTTP/1.0 401 Unauthorized");
echo "<h1>Authentication failed</h1>";
}
else
{
echo "<h1>Authentication succeeded</h1>";
}
?>
The php login "pop-up" is showing perfect but when I click "cancel login" my website will be loaded anyway.
How can I prevent loading my website?