http://arssus.loc/page/admin/
<?php
// $url = admin_url( 'http://arssus.loc/page/admin/', 'https' );
// echo $url;
// die();
$email = $_POST['email'];
$password = $_POST['pass'];
$error = '';
$success = '';
if(isset($_POST['submit'])){
if ($email == "xxxxxxxxxxxxxxx"){
if ($password == "xxxxxxxxxxxxx") {
$error = "";
$success = "welcome Admin!";
header('Location: ../../index.php');
}
else{
header('Location: ../../page-login.php');
}
}
else{
header('Location: ../../page-login.php');
}
}
else{
header('Location: ../../page-login.php');
}
$login = 'admin';
$password = 'password';
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="Administration"');
header($_SERVER['SERVER_PROTOCOL'].' 401 Unauthorized');
echo 'Доступ запрещен';
} else {
if ($_SERVER['PHP_AUTH_USER'] == $login) {
if ($_SERVER['PHP_AUTH_PW'] == $password) {
// все ок, можно передать в шаблон логин например $_SERVER['PHP_AUTH_USER']
} else {
header('WWW-Authenticate: Basic realm="Админка"');
header($_SERVER['SERVER_PROTOCOL'].' 401 Unauthorized');
}
}
}