Файл: app/classes/Admin.php
Строк: 26
<?php
class Admin extends Base {
public static function index() {
$error = null;
if (parent::isMethod('POST')) {
$password = parent::data('password');
if (empty($password))
$error = 'Пароль не введен';
elseif ($password != PASSWORD)
$error = 'Не верный пароль';
if ( ! $error) {
@setcookie('admin_verify', md5($password), time() + 3600 * 24 * 365, '/');
Flight::redirect('/admin');
}
}
$sql = "SELECT COUNT(*) FROM fo_video";
$res = Flight::db()->query($sql);
$total = $res->fetchColumn();
$sql = "SELECT COUNT(*) FROM fo_video WHERE moderation = '1'";
$res = Flight::db()->query($sql);
$total_m = $res->fetchColumn();
parent::view('admin/index', [
'title' => 'Админ Панель',
'error' => $error,
'admin' => parent::admin(),
'description' => '',
'keywords' => '',
'counts' => array('total' => $total, 'total_m' => $total_m)
]);
}
public static function exits() {
setcookie('admin_verify', null, time() - 3600, '/');
Flight::redirect('/');
}
}