View file entry.php

File size: 771B
<?php
define('_CMEX_', 1);

require 'core/core.php';
$Show->start();
echo '<div class="top">Гостевая</div>';

if (isset($_POST['entry'])) {

$admin = $Filter->txt($_POST['admin']);
    
if (empty($admin)) {
$Show->err('Не введен пароль');    
}
elseif ($admin != ADMIN) {
$Show->err('Неверный пароль');
}
else
{
$_SESSION['admin'] = 1;

header('location: /?entry_ok');
}
}

if (!isset($_POST['entry']) && isset($_SESSION['admin'])) {

unset($_SESSION['admin']);
header('Location: /?exit');
}
else
{
echo '<form method="POST" action="?">
<div class="menu">
<input name="admin" type="password" maxlength="20" placeholder="Пароль"/><br />
<input type="submit" name="entry" value="Войти"/>
</div>
</form>';
 }

$Show->end();
?>