File size: 751B
<?php
require_once 'core/system.php';
require_once 'core/head.php';
switch($act) {
case 'post':
if(isset($_POST['nick']) && isset($_POST['pass'])) {
$nick = check($_POST['nick']);
$pass = check($_POST['pass']);
if(mysql_result(mysql_query("SELECT COUNT(pol) FROM `user` WHERE `nick` = '".$nick."' && `pass` = '".$pass."'"),0) == false) $err = 'Неверный ник или пароль';
if(!isset($err)) {
setcookie('nick', $nick, time() + 84600 * 15, '/');
setcookie('pass', $pass, time() + 84600 * 15, '/');
header('Location: /');
exit();
} else {
header('Location: /');
$_SESSION['err'] = $err;
exit();
}
} else {
header('Location: /');
$_SESSION['err'] = 'Заполните поля';
exit();
}
}
require_once 'core/foot.php';
?>