Unified Captcha

This commit is contained in:
2023-08-28 14:23:41 +03:00
parent 294575021a
commit 045803087d
35 changed files with 374 additions and 484 deletions
+20 -10
View File
@@ -2,6 +2,7 @@
/* Главный игровой файл. */
use Captcha\Captcha;
use Core\Config;
use Core\Database;
use Core\Db;
@@ -26,33 +27,42 @@ function er($e)
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();
if (empty($u->info)) {
exit(Config::get('exit'));
}
$filter = new Filter();
$chat = new Chat();
$userclan = new Clan($u->info);
ini_set('max_execution_time', '120');
if (isset($_GET['showcode'])) {
include_once 'show_reg_img/security.php';
die();
$security = new Captcha();
$security->width(107)->height(26)->newImage();
$_SESSION['code'] = $security->getSum();
exit();
}
if (isset($u->info['joinIP']) && $u->info['joinIP'] == 1 && $u->info['ip'] != IP) {
er('#Пожалуйста авторизируйтесь с главной страницы');
} elseif (isset($_GET['exit'])) {
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']]);
die(Config::get('exit'));
} elseif (!isset($u->info['id'])) {
er('Возникла проблема с определением id персонажа<br>Авторизируйтесь с главной страницы.');
gameexit();
}
if ($u->info['online'] < time() - 60) {