Файл: plugins/page/sign.in.php
Строк: 25
<?php
core::only('guest');
$title = 'Авторизация';
require (SYS.'head.php');
if (!empty($_POST['login']) && !empty($_POST['password']))
{
if ($db->query("SELECT * FROM `users` WHERE `login` = '".core::input($_POST['login'])."' AND `password` = '".core::encode($_POST['password'])."' ")->num_rows == 1)
{
$user = $db->query("SELECT `id`, `hash` FROM `users` WHERE `login` = '".core::input($_POST['login'])."' AND `password` = '".core::encode($_POST['password'])."' ")->fetch_assoc();
setcookie('id_user', $user['id'], time()+60*60*24*365, '/');
setcookie('hash', $user['hash'], time()+60*60*24*365, '/');
core::go('/');
}
else
$error = 'Неправильный логин или пароль.';
}
core::show('error');
$elements[] = [
'type' => 'input',
'title' => 'Логин',
'br' => 1,
'info' => [
'name' => 'login',
]
];
$elements[] = [
'type' => 'password',
'title' => 'Пароль',
'br' => 1,
'info' => [
'name' => 'password',
]
];
$elements[] = [
'type' => 'submit',
'info' => [
'value' => 'Войти'
]
];
$smarty->assign([
'method' => 'POST',
'action' => '?',
'el' => $elements
]);
$smarty->display('form.tpl');
require (SYS.'foot.php');