файл enter.php:
<?php
$logi = "qwe";
$passw = "ewq";
$error_message = "
<form method='post' action='' class='login'>
<p>
<label for='login'>Логин:</label>
<input type='text' name='log' id='login' value=''>
</p>
<p>
<label for='password'>Пароль:</label>
<input type='password' name='pas' id='password' value=''>
</p>
<p class='login-submit'>
<button type='submit' class='login-button'>Войти</button>
</p>
</form>";
extract($HTTP_POST_VARS);
extract($HTTP_COOKIE_VARS);
if (!isset($log) && !isset($pas)) {
if (isset($_COOKIE['admin'])) {
$user_info = explode("|", $admin);
if ($user_info[0] != $logi or $user_info[1] != $passw) {
echo $error_message;
die();
}
}
else {
echo $error_message;
die();
}
}
if (isset($log) && isset($pas)) {
if ($log != $logi or $pas != $passw)
{
echo $error_message;
die();
}
else {
setcookie("admin", $log."|".$passw."|", time()+3600*24*14, "/");
}
}
?>
файл defauil.php
<?php
include('mods/enter.php');
echo "main page";
?>