Оптимизация логики

This commit is contained in:
Ivor Barhansky 2023-01-06 18:23:53 +02:00
parent 01b64fdebe
commit 3f3de15fa2

View File

@ -1322,13 +1322,12 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
if (Core\Config::get('securetime') > 0) {
if (!defined('IP')) {
$dip = $_SERVER['REMOTE_ADDR'];
define('IP', $dip);
define('IP', $_SERVER['REMOTE_ADDR']);
}
if (isset($this->info['id']) && ($this->info['ip'] != IP || $this->info['banned'] > 0) && $_SERVER['REQUEST_URI'] != '/') {
unset($this->info, $_COOKIE['login'], $_COOKIE['pass']);
die('<script>top.location.href="https://new-combats.com/";</script>');
die(Config::get('exit'));
}
}
@ -1379,11 +1378,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
$this->info['__id'] = $md[8];
$this->info['__level'] = $md[9];
}
if (isset ($_COOKIE['btl'])) {
if ($this->info['battle'] != $_COOKIE['btl']) {
setcookie('btl', $this->info['battle'], time() + 86400);
}
} else {
if (!isset ($_COOKIE['btl']) || $this->info['battle'] != $_COOKIE['btl']) {
setcookie('btl', $this->info['battle'], time() + 86400);
}
@ -1397,7 +1392,6 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
if (!isset($this->info['id'])) {
unset($this->info);
setcookie('login', '', time() - 60 * 60 * 24, '', Core\Config::get('host'));
setcookie('pass', '', time() - 60 * 60 * 24, '', Core\Config::get('host'));
} else {
echo 'stats is lost.';
}