ошибки Undefined

This commit is contained in:
2023-08-16 01:48:29 +03:00
parent 0f30620f61
commit 80ef052c6e
13 changed files with 1900 additions and 2205 deletions
+84 -138
View File
@@ -21,9 +21,8 @@ $code = PassGen::intCode();
if (
!isset($u->info['id']) ||
$u->info['banned'] > 0 ||
!isset($_COOKIE['login']) ||
$u->info['repass'] > 0
$u->isBlocked() ||
!isset($_COOKIE['login'])
) {
exit(json_encode(['js' => 'top.location="bk?exit=' . $code . '";']));
}
@@ -89,7 +88,7 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
for ($j = 0; $j < count($x); $j++) {
$uname = '&lt;Внутренняя ссылка&gt;';
//
if (strripos($x[$j], 'new-combats.com/info/')) {
if (strripos($x[$j], Config::get('host') . '/info')) {
$ulogin = explode('/info/', $x[$j]);
$ulogin = $ulogin[1];
$ulogin = Db::getValue('select login from users where id = ? or login = ?', [$ulogin, $ulogin]);
@@ -107,7 +106,7 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
} else {
$uname = '<span style="color: #5f9b00; ">&lt;Библиотека предметов&gt;</span>';
}
} elseif (strripos($x[$j], 'new-combats.com/news')) {
} elseif (strripos($x[$j], Config::get('host') . '/news')) {
$ulogin = explode('/news', $x[$j]);
$ulogin = $ulogin[1];
$ulogin = ltrim($ulogin, '/');
@@ -117,7 +116,7 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
} else {
$uname = '<span style="color: #b57300; ">&lt;Новостная лента&gt;</span>';
}
} elseif (strripos($x[$j], 'new-combats.com/lib')) {
} elseif (strripos($x[$j], Config::get('host') . '/lib')) {
$ulogin = explode('/lib', $x[$j]);
$ulogin = $ulogin[1];
$ulogin = ltrim($ulogin, '/');
@@ -128,7 +127,7 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
} else {
$uname = '<span style="color: #4c6e00; ">&lt;Библиотека&gt;</span>';
}
} elseif (strripos($x[$j], 'new-combats.com/forum')) {
} elseif (strripos($x[$j], Config::get('host') . '/forum')) {
$ulogin = explode('/forum?read=', $x[$j]);
$ulogin = $ulogin[1];
$ulogin = explode('&', $ulogin);
@@ -151,7 +150,7 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
}
//
$newbuf .= preg_match(
"/(https:\\/\\/)?(new-combats+\\.com(([ \"'>\r\n\t])|(\\/([^ \"'>\r\n\t]*)?)))/",
"/(https:\\/\\/)?(new-combats+\\.tech(([ \"'>\r\n\t])|(\\/([^ \"'>\r\n\t]*)?)))/",
$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])) . " " : $x[$j] . " ";
@@ -244,13 +243,11 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
} else {
$u->info['molch1'] = -1;
}
mysql_query(
'UPDATE `users` SET `molch1` = "' . $u->info['molch1'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
);
Db::sql('update users set molch1 = ? where id = ?', [$u->info['molch1'], $u->info['id']]);
}
} elseif ((preg_match("/private\[(.*?)\]/", $_POST['msg'], $msg['to']) || preg_match(
"/private \[(.*?)\]/", $_POST['msg'], $msg['to']
)) && $u->info['exp'] < 150000) {
)) && $u->info['exp'] < 150000 && !$u->isAdmin()) {
$r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","<small>Вы не можете отправлять приват до достижения 150000 опыта.</small>","Black","1","1","0"]);';
} else {
@@ -285,10 +282,10 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
$_POST['msg'] = str_replace('to [' . $msg['to'] . ']', ' ', $_POST['msg']);
}
if ($u->info['admin'] == 0) { //ТУТ SPAM
if ($msg['to'] != '' && !isset($admq['id']) && $msg['type'] == 3) {
$admq = Db::getRow('select id, admin from users where login = ? and admin > 0', [$msg['to']]);
if ($msg['to'] != '' && !isset($admq) && $msg['type'] == 3) {
$admq = Db::getValue('select id from users where login = ? and admin > 0', [$msg['to']]);
}
if (!isset($admq['id'])) {
if (!isset($admq)) {
$msg['fspam'] = $filter->spamFiltr(str_replace('точка', '.', str_replace('ру', 'ru', $_POST['msg'])));
if ($msg['fspam'] != '0') {
$msg['spam'] = 1;
@@ -306,9 +303,7 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
$u->addAction(time(), 'msg_bans', '1');
$mban['vals'] = 0;
} else {
mysql_query(
'UPDATE `actions` SET `vals` = `vals` + 1 WHERE `id` = "' . $mban['id'] . '" LIMIT 1'
);
Db::sql('update actions set vals = vals + 1 where id = ?', [$mban['id']]);
$msg['delete'] = time();
}
@@ -327,30 +322,19 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
$chat->sendMsg($cmsg);
$molchTime = time() + 60 * 60;
mysql_query(
'UPDATE `users` SET
`molch1` = ' . $molchTime . ',
`molch2` = ' . $molchTime . ',
`info_delete` = ' . $molchTime . '
WHERE `id` = ' . $u->info['id']);
$rtxt = $rang . ' &quot;' . $u->info['login'] . '&quot; <small><font color=red>Автоинформатор</font></small>: ' . $msg['text'] . ' [' . $msg['fspam'] . '].';
mysql_query(
"INSERT INTO `users_delo` (`uid`,`ip`,`city`,`time`,`text`,`login`,`type`) VALUES ('" . $u->info['id'] . "','" . $_SERVER['REMOTE_ADDR'] . "','" . $u->info['city'] . "','" . time() . "','" . $rtxt . "','" . $u->info['login'] . "',0)"
);
Db::sql('update users set molch1 = ?, molch2 = ?, info_delete = ? where id = ?', [$molchTime, $molchTime, $molchTime, $u->info['id']]);
$rtxt = ' &quot;' . $u->info['login'] . '&quot; <small style="color: red;">Автоинформатор</small>: ' . $msg['text'] . ' [' . $msg['fspam'] . '].';
Delo::add(0, $u->info['login'], $u->info['id'], $rtxt);
}
}
}
unset($admq);
}
$qix = mysql_fetch_array(
mysql_query(
'SELECT `id` FROM `friends` WHERE `ignor` > 0 AND `login_ignor` = "' . mysql_real_escape_string(
$pl['login']
) . '" AND (`user_ignor` = "' . $u->info['login'] . '" OR `user` = "' . $u->info['id'] . '") LIMIT 1'
)
);
if (isset($qix['id'])) {
$qix = Db::getValue('select id from friends where ignor > 0 and login_ignor = ? and (user_ignor = ? or user = ?)', [$pl['login'], $u->info['login'], $u->info['id']]);
if (isset($qix)) {
$r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","<b>Вас добавили в игнор</b>: Вы не можете отправлять сообщения персонажу &quot;' . htmlspecialchars(
$msg['to']
) . '&quot;.","Black","1","1","0"]);';
@@ -366,19 +350,10 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
}
}
if ($u->info['molch1'] > time()) {
if ($msg['to'] != '' && !isset($admq['id'])) {
$admq = mysql_fetch_array(
mysql_query(
'SELECT `id`,`admin` FROM `users` WHERE `login` = "' . mysql_real_escape_string(
$msg['to']
) . '" AND `admin` > 0 LIMIT 1'
)
);
if ($msg['type'] != 3) {
unset($admq);
}
if ($msg['to'] != '' && !isset($admq) && $msg['type'] === 3) {
$admq = Db::getValue('select id from users where login = ? and admin > 0', [$msg['to']]);
}
if (!isset($admq['id'])) {
if (!isset($admq)) {
$msg['molch'] = 1;
}
}
@@ -435,7 +410,6 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
$cmsg->setMolch($msg['molch']);
$cmsg->setLogin($u->info['login']);
$cmsg->setTo($msg['to']);
$cmsg->setCity($u->info['city']);
$cmsg->setRoom($u->info['room']);
$cmsg->setType($msg['type']);
$cmsg->setSpam($msg['spam']);
@@ -509,6 +483,7 @@ if ($_GET['r1'] != 0) {
$usl = [];
$cw = [];
$usid = [];
$onlineListQuery = 'select
users.id, pass, sex, dnow, timeMain, bot, atack, afk, dnd, banned, molch1,
room, city, cityreg, online, align, clan, login, level, inTurnir, battle, invis, inUser, x, y
@@ -521,143 +496,120 @@ where
mail != ? and
room != ?
order by inUser desc, online desc, login desc';
$sp = Db::getRows($onlineListQuery, [$u->info['room'], '%saint%', '', BOT_ROOM]);
foreach ($sp as $pl) {
// }
//
// $sp = mysql_query(
// 'SELECT
// `u`.`pass`,
// `u`.`sex`,
// `s`.`dnow`,
// `u`.`timeMain`,
// `s`.`bot`,`s`.`atack`,`u`.`afk`,`u`.`dnd`,`u`.`banned`,`u`.`molch1`,`u`.`room`,`u`.`id`,`u`.`city`,`u`.`cityreg`,`u`.`online`,`u`.`align`,
// `u`.`clan`,`u`.`login`,`u`.`level`,`u`.`inTurnir`,`u`.`battle`,`u`.`invis`,`u`.`inUser`,`s`.`x`,`s`.`y`
//FROM
//`users` AS `u`
// LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id`
//WHERE (
// (`u`.`room` = "' . $u->info['room'] . '" AND "' . mysql_real_escape_string((int)$_GET['r3']) . '" != "1") OR
// ("' . mysql_real_escape_string((int)$_GET['r3']) . '" = "1" AND `pass` NOT LIKE "%saint%")) AND
// `mail`!="No E-mail" AND
// `room` != "303"
// ORDER BY `u`.`inUser` DESC,`u`.`online` DESC,`u`.`login` DESC LIMIT 1000'
// );
// $ar_id = 0;
// $ar_lvl = 0;
// $ar_all = '0';
// $usl = [];
// $cw = [];
// $usid = [];
// while ($pl = mysql_fetch_array($sp)) {
$usersOnline = Db::getRows($onlineListQuery, [$u->info['room'], '%saint%', '', BOT_ROOM]);
foreach ($usersOnline as $onlineUser) {
$ysee = 1;
if ($pl['inUser'] > 0) {
if ($pl['inTurnir'] == 0) {
if ($onlineUser['inUser'] > 0) {
if ($onlineUser['inTurnir'] == 0) {
$ysee = 0;
} else {
if ($pl['online'] < time() - 120) {
User::setOnline($pl['id']);
if ($onlineUser['online'] < time() - 120) {
User::setOnline($onlineUser['id']);
}
}
} else {
if ($pl['inTurnir'] > 0) {
if ($onlineUser['inTurnir'] > 0) {
$ysee = 0;
}
}
if (!isset($usl[$pl['login']])) {
if (!isset($usl[$onlineUser['login']])) {
$ysee = 1;
}
if (
(
(int)$_GET['r3'] != 1 &&
$u->info['dnow'] != $pl['dnow']
$u->info['dnow'] != $onlineUser['dnow']
) ||
(
$pl['room'] >= 362 &&
$pl['room'] <= 366 &&
$onlineUser['room'] >= 362 &&
$onlineUser['room'] <= 366 &&
(int)$_GET['r3'] != 1 &&
(
$pl['x'] != $u->info['x'] ||
$pl['y'] != $u->info['y'] ||
$pl['room'] != $u->info['room']
$onlineUser['x'] != $u->info['x'] ||
$onlineUser['y'] != $u->info['y'] ||
$onlineUser['room'] != $u->info['room']
)
) ||
$usid[$pl['login']]
!empty($usid[$onlineUser['login']])
) {
$ysee = 0;
}
$usl[$pl['login']] = $pl['id'];
if (isset($onlineUser['login'])) {
$usl[$onlineUser['login']] = $onlineUser['id'];
}
if (
(
$pl['online'] > time() - 520 ||
$pl['inUser'] > 0
$onlineUser['online'] > time() - 520 ||
$onlineUser['inUser'] > 0
) &&
(
$pl['bot'] != 1 ||
$pl['pass'] == '212121q'
$onlineUser['bot'] != 1 ||
$onlineUser['pass'] == '212121q'
) &&
$pl['banned'] == 0 &&
$onlineUser['banned'] == 0 &&
$ysee == 1
) {
$usid[$pl['login']] = true;
if ($pl['invis'] != 1 && $pl['invis'] < time()) {
if ($pl['clan'] > 0) {
if ($u->info['clan'] > 0 && $pl['clan'] != $u->info['clan']) {
if (!isset($cw['war'][$pl['clan']][$u->info['clan']])) {
$pl['cwar'] = mysql_fetch_array(
$usid[$onlineUser['login']] = true;
if ($onlineUser['invis'] != 1 && $onlineUser['invis'] < time()) {
if ($onlineUser['clan'] > 0) {
if ($u->info['clan'] > 0 && $onlineUser['clan'] != $u->info['clan']) {
if (!isset($cw['war'][$onlineUser['clan']][$u->info['clan']])) {
$onlineUser['cwar'] = mysql_fetch_array(
mysql_query(
'SELECT `id`,`type` FROM `clan_wars` WHERE
((`clan1` = "' . $pl['clan'] . '" AND `clan2` = "' . $u->info['clan'] . '") OR (`clan2` = "' . $pl['clan'] . '" AND `clan1` = "' . $u->info['clan'] . '")) AND
((`clan1` = "' . $onlineUser['clan'] . '" AND `clan2` = "' . $u->info['clan'] . '") OR (`clan2` = "' . $onlineUser['clan'] . '" AND `clan1` = "' . $u->info['clan'] . '")) AND
`time_finish` > ' . time() . ' LIMIT 1'
)
);
if (isset($pl['cwar']['id'])) {
$cw['war'][$pl['clan']][$u->info['clan']] = $pl['cwar']['type'];
if (isset($onlineUser['cwar']['id'])) {
$cw['war'][$onlineUser['clan']][$u->info['clan']] = $onlineUser['cwar']['type'];
} else {
$cw['war'][$pl['clan']][$u->info['clan']] = 0;
$cw['war'][$onlineUser['clan']][$u->info['clan']] = 0;
}
}
if ($cw['war'][$pl['clan']][$u->info['clan']] > 0) {
$pl['atack'] = $cw['war'][$pl['clan']][$u->info['clan']];
if ($cw['war'][$onlineUser['clan']][$u->info['clan']] > 0) {
$onlineUser['atack'] = $cw['war'][$onlineUser['clan']][$u->info['clan']];
}
}
if (!isset($cw[$pl['clan']])) {
$pl['clan'] = mysql_fetch_array(
mysql_query('SELECT `name_mini` FROM `clan` WHERE `id` = "' . $pl['clan'] . '" LIMIT 1')
if (!isset($cw[$onlineUser['clan']])) {
$onlineUser['clan'] = mysql_fetch_array(
mysql_query('SELECT `name_mini` FROM `clan` WHERE `id` = "' . $onlineUser['clan'] . '" LIMIT 1')
);
} else {
$pl['clan'] = $cw[$pl['clan']];
$onlineUser['clan'] = $cw[$onlineUser['clan']];
}
$pl['clan'] = $pl['clan']['name_mini'];
$onlineUser['clan'] = $onlineUser['clan']['name_mini'];
}
if ($pl['atack'] > time() || $pl['atack'] == 1 || $pl['atack'] == 2) {
if ($pl['atack'] != 2) {
$pl['atack'] = 1;
if ($onlineUser['atack'] > time() || $onlineUser['atack'] == 1 || $onlineUser['atack'] == 2) {
if ($onlineUser['atack'] != 2) {
$onlineUser['atack'] = 1;
}
} else {
$pl['atack'] = 0;
$onlineUser['atack'] = 0;
}
$trvm = mysql_fetch_array(
mysql_query(
'SELECT `id`,`name` FROM `eff_users` WHERE `uid` = "' . $pl['id'] . '" AND (`id_eff` = "4" OR `id_eff` = "6") AND `delete` = "0" ORDER BY `id_eff` ASC LIMIT 6'
)
);
$trvm = $trvm['name'];
$r['list'] .= '"' . $r['xu'] . '":["' . $pl['id'] . '","' . $pl['login'] . '","' . $pl['level'] . '","' . $pl['align'] . '","' . $pl['clan'] . '","' . $pl['cityreg'] . '","' . $pl['city'] . '","' . $pl['room'] . '","' . $pl['afk'] . '","' . $pl['dnd'] . '","' . $pl['banned'] . '","' . $pl['molch1'] . '","' . $pl['battle'] . '","' . $pl['atack'] . '","' . $trvm . '","' . ($pl['sex'] * 0) . '","' . $pl['align2'] . '"],';
$ar_id += $pl['id'];
$ar_lvl += $pl['level'];
$ar_all .= $pl['align'] . $pl['clan'] . $pl['molch1'] . $pl['banned'] . $pl['battle'] . 1;
$trvm = Db::getValue('select name from eff_users where uid = ? and id_eff in (4,6) order by id_eff limit 1', [$onlineUser['id']]);
$r['list'] .= '"' . $r['xu'] . '":["' . $onlineUser['id'] . '","' . $onlineUser['login'] . '","' . $onlineUser['level'] . '","' . $onlineUser['align'] .
'","' . $onlineUser['clan'] . '","' . $onlineUser['cityreg'] . '","' . $onlineUser['city'] . '","' . $onlineUser['room'] .
'","' . $onlineUser['afk'] . '","' . $onlineUser['dnd'] . '","' . $onlineUser['banned'] . '","' . $onlineUser['molch1'] . '","' .
$onlineUser['battle'] . '","' . $onlineUser['atack'] . '","' . $trvm . '","' . ($onlineUser['sex'] * 0) . '"],';
$ar_id += $onlineUser['id'];
$ar_lvl += $onlineUser['level'];
$ar_all .= $onlineUser['align'] . $onlineUser['clan'] . $onlineUser['molch1'] . $onlineUser['banned'] . $onlineUser['battle'] . 1;
}
$r['xu']++;
}
}
unset($pl, $sp);
unset($onlineUser, $sp);
$r['list'] = rtrim($r['list'], ',');
$r['list'] = '{' . $r['list'] . '}';
}
@@ -884,14 +836,8 @@ while ($pl = mysql_fetch_array($sp)) {
if ($see == 1 && $pl['delete'] == 0 && $pl['login'] != '') {
$qix = mysql_fetch_array(
mysql_query(
'SELECT `id` FROM `friends` WHERE `ignor` > 0 AND `login_ignor` = "' . mysql_real_escape_string(
$pl['login']
) . '" AND (`user_ignor` = "' . $u->info['login'] . '" OR `user` = "' . $u->info['id'] . '") LIMIT 1'
)
);
if (isset($qix['id'])) {
$qix = Db::getValue('select id from friends where ignor > 0 and login_ignor = ? and (user_ignor = ? or user = ?)', [$pl['login'], $u->info['login'], $u->info['id']]);
if (isset($qix)) {
$see = 0;
}
unset($qix);
@@ -1008,7 +954,7 @@ $r['msg'] = '{"ld":"' . (0 + $l) . '","id":"' . $i . '"' . $r['msg'] . '}';
//Генерируем ключ
$r['key'] = md5($u->room['name'] . '+' . $ar_id . '+' . $ar_lvl . '+' . $ar_all);
unset($ar_id, $ar_lvl);
if ($_COOKIE['chatCfg12'] == 0) {
if (empty($_COOKIE['chatCfg12'])) {
$_GET['key'] = time();
}
if ($r['key'] == $_GET['key']) {