<?php
function auth_send(){
header('WWW-Authenticate: Basic realm="Closed Zone"');
header('HTTP/1.0 401 Unauthorized');
echo "<html><body bgcolor=white link=blue vlink=blue alink=red>"
,"<h1>Доступ запрещён</h1>"
,"<p>неправильные логин/пароль</p>"
,"</body></html>";
exit;
};
$login = "admin";
$password = "12345";
if (!isset($_SERVER['PHP_AUTH_USER'])) {
auth_send();
} else {
$auth_user = $_SERVER['PHP_AUTH_USER'];
$auth_pass = $_SERVER['PHP_AUTH_PW'];
if (($auth_user != $login) || ($auth_pass != $password)) {
auth_send();}
};
?>