From c6476001419535753ec2a421a57b478d287e428e Mon Sep 17 00:00:00 2001 From: Ivor Barhansky Date: Thu, 12 Jan 2023 05:08:32 +0200 Subject: [PATCH] various small --- _incl_data/class/User.php | 37 +++++++++++++------------- buttons.php | 43 +++++++++++++++++------------- lotowork.php | 2 +- main.php | 55 +++++---------------------------------- modules_data/_umenie.php | 19 ++++++-------- 5 files changed, 60 insertions(+), 96 deletions(-) diff --git a/_incl_data/class/User.php b/_incl_data/class/User.php index 503fbbf0..369bed55 100644 --- a/_incl_data/class/User.php +++ b/_incl_data/class/User.php @@ -1880,7 +1880,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` private function __construct() { if (!empty($_SESSION['uid'])) { - $this->info = Db::getRow( + $user = Db::getRow( 'select *, users.id as id, @@ -1898,7 +1898,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` [$_SESSION['uid']] ); } else { - $this->info = Db::getRow( + $user = Db::getRow( 'select *, users.id as id, @@ -1917,9 +1917,10 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` ); } - if (empty($this->info)) { - $this->info = []; + if (!empty($user) && is_array($user)) { + $this->info = $user; } + unset($user); Database::init(); // для всяких mysql_* @@ -1940,20 +1941,20 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` setcookie('btl', $this->info['battle'], time() + 86400); } - if (!isset($this->info['id'])) { - $this->info = Db::getRow('select * from users where login = ?', [$_COOKIE['login']]); - - if ($this->info['dateEnter'] != $_SERVER['HTTP_USER_AGENT']) { - unset($this->info); - } - $this->btl_txt = $this->info['battle_text']; - if (!isset($this->info['id'])) { - unset($this->info); - setcookie('login', '', time() - 60 * 60 * 24, '', Core\Config::get('host')); - } else { - echo 'stats is lost.'; - } - } +// if (!isset($this->info['id'])) { +// $this->info = Db::getRow('select * from users where login = ?', [$_COOKIE['login']]); +// +// if ($this->info['dateEnter'] != $_SERVER['HTTP_USER_AGENT']) { +// unset($this->info); +// } +// $this->btl_txt = $this->info['battle_text']; +// if (!isset($this->info['id'])) { +// unset($this->info); +// setcookie('login', '', time() - 60 * 60 * 24, '', Core\Config::get('host')); +// } else { +// echo 'stats is lost.'; +// } +// } if (isset($this->info['id'])) { if ($this->info['invis'] == 1 || $this->info['invis'] > time()) { diff --git a/buttons.php b/buttons.php index baf5ece5..60185b89 100644 --- a/buttons.php +++ b/buttons.php @@ -1,13 +1,22 @@ Произошла ошибка

Произошла ошибка:

' . $e . '

Назад


(c) ' . $c[1] . '

'); } -include_once('_incl_data/__config.php'); -include_once('_incl_data/class/__db_connect.php'); +Config::init(); +Database::init(); + define('IP', UserIp::get()); $u = User::start(); $filter = new Filter(); @@ -24,9 +33,7 @@ if ($u->info['joinIP'] == 1 && $u->info['ip'] != IP) { er('#Пожалуйста авторизируйтесь с главной страницы'); } elseif (isset($_GET['exit'])) { setcookie('login', '', time() - 60 * 60 * 24 * 30, '', $c['host']); - setcookie('pass', '', time() - 60 * 60 * 24 * 30, '', $c['host']); setcookie('login', '', time() - 60 * 60 * 24 * 30); - setcookie('pass', '', time() - 60 * 60 * 24 * 30); mysql_query('UPDATE `users` SET `online` = ' . (time() - 420) . ' WHERE `id` = ' . $u->info['id']); //520 die(''); } elseif (!isset($u->info['id'])) { @@ -62,12 +69,12 @@ $u->stats = $u->getStats($u->info['id'], 0); '; ?> -