Запросы в несуществующий базы, снятие вещей из пустых слотов..

This commit is contained in:
2023-01-12 02:58:26 +02:00
parent f1d838fcc4
commit a1aca77a35
3 changed files with 44 additions and 55 deletions

View File

@@ -1,11 +1,17 @@
<?php
if (!defined('GAME_VERSION')) {
require_once '_incl_data/autoload.php';
}
use Core\Config;
use Core\Database;
use Core\Db;
//
const GAME = true;
require_once '_incl_data/__config.php';
require_once '_incl_data/class/__db_connect.php';
Config::init();
Database::init();
$u = User::start();
$filter = new Filter();
$chat = new Chat();
@@ -25,11 +31,11 @@ if ($u->info['bithday'] == '01.01.1800') {
}
if ($u->info['online'] < time() - 60) {
mysql_query('UPDATE users SET online = unix_timestamp() WHERE id = ' . $u->info['id']);
Db::sql('update users set online = unix_timestamp() where id = ?', [$u->info['id']]);
$filter->setOnline($u->info['online'], $u->info['id']);
}
function isModerOrAdmin($uinfo)
function isModerOrAdmin($uinfo): bool
{
return $uinfo['admin'] > 0 ||
(
@@ -42,19 +48,13 @@ function isModerOrAdmin($uinfo)
}
if (isset($_POST['delMsg']) && isModerOrAdmin($u->info)) {
if (((int)$_POST['delMsg']) > 0) {
mysql_query(
'UPDATE `chat` SET `delete` = "' . $u->info['id'] . '" WHERE `id` = "' . mysql_real_escape_string(
((int)$_POST['delMsg'])
) . '" LIMIT 1'
);
$delmsgid = (int)$_POST['delMsg'];
if ($delmsgid > 0) {
Db::sql('update chat set `delete` = ? where id = ?', [$u->info['id'], $delmsgid]);
} else {
mysql_query(
'UPDATE `users` SET `molch3` = "' . (time() + 3600 * 3) . '" WHERE `id` = "' . mysql_real_escape_string(
-((int)$_POST['delMsg'])
) . '" LIMIT 1'
);
Db::sql('update users set molch3 = unix_timestamp() + 3600 * 3 where id = ?', [-$delmsgid]);
}
unset($delmsgid);
}
$r = [
@@ -81,7 +81,7 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
$_POST['msg'] = str_replace('\x3C', '<', $_POST['msg']);
$_POST['msg'] = str_replace('\x3', '>', $_POST['msg']);
function tolink($buf)
function tolink($buf): string
{
$x = explode(" ", $buf);
$newbuf = '';
@@ -192,10 +192,10 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
}
}
//
$newbuf .= preg_match
(
$newbuf .= preg_match(
"/(https:\\/\\/)?(new-combats+\\.com(([ \"'>\r\n\t])|(\\/([^ \"'>\r\n\t]*)?)))/",
$x[$j], $ok
$x[$j],
$ok
) ? str_replace(
$ok[2], "<small><a href=https://$ok[2] target=_blank ><i>" . $uname . "</i></a></small>",
str_replace("https://", "", $x[$j])