This commit is contained in:
2023-10-13 18:04:13 +03:00
parent bdbb359e20
commit 53f0e1108f
3 changed files with 43 additions and 66 deletions
+11 -27
View File
@@ -14,33 +14,20 @@ if (!defined('GAME_VERSION')) {
}
$code = PassGen::intCode();
function er($e)
{
$link = Config::get('https');
$err = <<<HTML
<div>
Ошибка: $e<br>
<a href="$link">Назад</a>
</div>
HTML;
exit($err);
}
function gameexit()
{
setcookie('login', '', 0, '', Config::get('host'));
setcookie('login', '', 0);
setcookie('auth', '', 0);
Db::sql('update users set online = unix_timestamp() - 420 where id = ?', [$u->info['id']]);
exit(Config::get('exit'));
}
Database::init();
define('IP', UserIp::get());
$u = User::start();
function gameexit(int $uid)
{
setcookie('login', '', 0, '', Config::get('host'));
setcookie('login', '', 0);
setcookie('auth', '', 0);
Db::sql('update users set online = unix_timestamp() - 420 where id = ?', [$uid]);
exit(Config::get('exit'));
}
if (empty($u->info)) {
exit(Config::get('exit'));
}
@@ -49,7 +36,6 @@ $filter = new Filter();
$chat = new Chat();
$userclan = new Clan($u->info);
ini_set('max_execution_time', '120');
if (isset($_GET['showcode'])) {
@@ -59,10 +45,8 @@ if (isset($_GET['showcode'])) {
exit();
}
if (isset($u->info['joinIP']) && $u->info['joinIP'] == 1 && $u->info['ip'] != IP) {
er('#Пожалуйста авторизируйтесь с главной страницы');
} elseif (isset($_GET['exit'])) {
gameexit();
if (isset($u->info['joinIP']) && $u->info['joinIP'] == 1 && $u->info['ip'] != IP || isset($_GET['exit'])) {
gameexit($u->info['id']);
}
if ($u->info['online'] < time() - 60) {