query('UPDATE `online` SET `real_time` = ?i WHERE `id` = ?i', time(), $u->i()['id']);
if (isset($_GET['online']) && $_GET['online'] != null) {
if ($_GET['room'] && (int)$_GET['room'] < 500) {
$user->room = (int)$_GET['room'];
}
if ($u->i()['caveleader'] > 0) {
$data = db::c()->query('
SELECT
`align`,
`u`.`id`,
`klan`,
`level`,
`login`,
`u`.`battle` AS `in_battle`,
`o`.`date`,
`u`.`invis`,
(SELECT `id` FROM `effects` WHERE `type` = 2 AND `owner` = `u`.`id` LIMIT 1) AS `slp`,
(SELECT `id` FROM `effects` WHERE (`type` = 11 OR `type` = 12 OR `type` = 13 OR `type` = 14) AND `owner` = `u`.`id` LIMIT 1) AS `trv`
FROM
`online` AS `o`,
`users` AS `u`
WHERE
`o`.`id` = `u`.`id` AND
(`o`.`date` >= ' . (time() - 90) . ' OR `u`.`in_tower` = 1) AND
`o`.`room` = "' . $u->i()['room'] . '" AND
`u`.`caveleader` = "' . $u->i()['caveleader'] . '"
ORDER BY
`u`.`login`
');
$ttl = "" . $rooms[$user->room] . " (" . mysql_num_rows($data) . ")";
$ch1 = '_active';
$ch2 = '_passive';
$ch3 = '_passive';
$ch4 = '_passive';
$ch5 = '_passive';
} elseif ($user->room == 760) {
$forest = db::c()->query('SELECT `id`, `room`, `time`, `user`, `data` FROM `forest` WHERE `user` = "' . $user['id'] . '" LIMIT 1')->fetch_assoc();
$sp = db::c()->query('SELECT `id`, `room`, `user` FROM `forest` WHERE `room` = "' . $forest['room'] . '"');
while ($pl = $sp->fetch_assoc()) {
$uss .= ', ';
$uss .= $pl['user'];
}
if ($uss != '') {
$uss = ltrim($uss, ', ');
}
$data = db::c()->query('
SELECT
`align`,
`u`.`id`,
`klan`,
`action`,
`level`,
`login`,
`u`.`battle` AS `in_battle`,
`o`.`date`,
`u`.`invis`,
(SELECT `id` FROM `effects` WHERE `type` = 2 AND `owner` = `u`.`id` LIMIT 1) AS `slp`,
(SELECT `id` FROM `effects` WHERE (`type` = 11 OR `type` = 12 OR `type` = 13 OR `type` = 14) AND `owner` = `u`.`id` LIMIT 1) AS `trv`
FROM
`online` AS `o`,
`users` AS `u`
WHERE
`o`.`id` = `u`.`id` AND
(`o`.`date` >= ' . (time() - 90) . ' OR `u`.`in_tower` = 1) AND
`u`.`id` IN (' . $uss . ')
ORDER BY
`u`.`login`
');
$ttl = "" . $var_map[$forest['room']] . " (" . mysql_num_rows($data) . ")";
$ch1 = '_active';
$ch2 = '_passive';
$ch3 = '_passive';
$ch4 = '_passive';
$ch5 = '_passive';
} else {
$data = db::c()->query('
SELECT
`align`,
`u`.`id`,
`klan`,
`action`,
`level`,
`login`,
`u`.`battle` AS `in_battle`,
`o`.`date`,
`u`.`invis`,
(SELECT `id` FROM `effects` WHERE `type` = 2 AND `owner` = `u`.`id` LIMIT 1) AS `slp`,
(SELECT `id` FROM `effects` WHERE (`type` = 11 OR `type` = 12 OR `type` = 13 OR `type` = 14) AND `owner` = `u`.`id` LIMIT 1) AS `trv`
FROM
`online` AS `o`,
`users` AS `u`
WHERE
`o`.`id` = `u`.`id` AND
(`o`.`date` >= ' . (time() - 90) . ' OR `u`.`in_tower` = 1) AND
`o`.`room` = "' . $user->room . '"
ORDER BY
`u`.`login`
');
$ttl = "" . $rooms[$user->room] . " (" . mysql_num_rows($data) . ")";
$ch1 = '_active';
$ch2 = '_passive';
$ch3 = '_passive';
$ch4 = '_passive';
$ch5 = '_passive';
}
?>
= $rooms[$user->room], ' (', mysql_num_rows($data) ?>)
if ($user['first'] != 99) { ?>
} ?>
if (!$_GET['rms']) { ?>
|
if (!empty($user['klan'])) { ?>
|
} ?>
} ?>
if (!$_GET['room']) {
if (!isset($_GET['chview']) || $_GET['chview'] == 1) {
echo '';
} else {
echo '';
}
}
?>
echo '
' . $ttl . '
'; ?>
top.location.href='index.php';");
}
$cha = file("tmp/chat.txt");
header('Content-Type: text/html; charset=utf-8');
echo "";
db::c()->query("UPDATE `online` SET `date` = " . time() . " WHERE `id` = {$user['id']} LIMIT 1");
exit;
} else {
if (strpos($_GET['text'], "private") !== FALSE && $user['level'] < 1) {
preg_match_all("/\[(.*)\]/U", $_GET['text'], $matches);
for ($ii = 0; $ii < count($matches[1]); $ii++) {
$dde = db::c()->query("SELECT `id` FROM `users` WHERE ((`align`>1 AND `align`<2)) AND `login` = '" . trim($matches[1][$ii]) . "' LIMIT 1 ;")->fetch_assoc();
if (!$dde['id']) {
exit();
}
}
}
if (@trim($_GET['text']) != null) {
$rr = db::c()->query("SELECT `id` FROM `effects` WHERE `type` = 2 AND `owner` = {$user['id']};")->fetch_assoc();
# Ограничения на ввод символов в чат!
if (!isset($rr['id'])) {
$_GET['text'] = substr($_GET['text'], 0, 1024); // Ограничние на символы в чате!
$_GET['text'] = str_replace('<', '<', $_GET['text']);
$_GET['text'] = str_replace(']:[', '] : [', $_GET['text']);
$_GET['text'] = str_replace('>', '>', $_GET['text']);
$_GET['text'] = preg_replace('/private \[klan-([a-zA-Z]*)\]/', '', $_GET['text']);
if ($user['klan'] == '') {
$_GET['text'] = str_replace('private [klan]', '', $_GET['text']);
$_GET['text'] = str_replace('private [klan]', 'private [klan-' . $user['klan'] . ']', $_GET['text']);
} else {
$_GET['text'] = str_replace('private [klan]', 'private [klan-' . $user['klan'] . ']', $_GET['text']);
$_GET['text'] = preg_replace('/private \[klan-([1-9])\]/', 'private [klan-' . $user['klan'] . ']', $_GET['text']);
$pos = strpos($_GET['text'], "[klan-{$user['klan']}") + strlen($user['klan']) + 7;
}
if ($_GET['chtype'] == 6 && stristr($_GET['text'], 'private') === FALSE) {
$_GET['text'] = 'private [help] ' . $_GET['text'];
} elseif ($_GET['chtype'] == 8 && stristr($_GET['text'], 'private') === FALSE) {
$_GET['text'] = 'private [trade] ' . $_GET['text'];
} elseif ($_GET['chtype'] == 3 && $user['klan'] != '') {
$_GET['text'] = 'private [klan-' . $user['klan'] . '] ' . $_GET['text'];
} elseif ($_GET['chtype'] == 4 && (((int)$user['align'] == 1) || $user['admin'] == 1)) {
$_GET['text'] = 'private [pal] ' . $_GET['text'];
}
if ((int)$user['align'] != 1 && $user['admin'] != 1) {
$_GET['text'] = str_replace('private [pal]', '', $_GET['text']);
}
unset($tmp);
# Упростил тот Адъ и Израиль до одной нормальной строчки, которая вырежет все ссылки.
if (!preg_match(GAMEDOMAIN, $_GET['text']) || !preg_match("/imgur.com/", $_GET['text'])) {
$_GET['text'] = preg_replace("@((https?://)?([-\w]+\.[-\w\.]+)+\w(:\d+)?(/([-\w/_\.]*(\?\S+)?)?)*)@", '<РАП/РВС>', $_GET['text']);
}
$smiles = ["/:flowers:/", "/:inv:/", "/:hug:/", "/:horse:/", "/:str:/", "/:susel:/", "/:smile:/", "/:laugh:/", "/:fingal:/", "/:eek:/", "/:smoke:/", "/:hi:/", "/:bye:/", "/:king:/", "/:king2:/", "/:boks2:/", "/:boks:/", "/:gent:/", "/:lady:/", "/:tongue:/", "/:smil:/", "/:rotate:/", "/:ponder:/", "/:bow:/", "/:angel:/", "/:angel2:/", "/:hello:/", "/:dont:/", "/:idea:/", "/:mol:/", "/:super:/", "/:beer:/", "/:drink:/", "/:baby:/", "/:tongue2:/", "/:sword:/", "/:agree:/", "/:loveya:/", "/:kiss:/", "/:kiss2:/", "/:kiss3:/", "/:kiss4:/", "/:rose:/", "/:love:/", "/:love2:/", "/:confused:/", "/:yes:/", "/:no:/", "/:shuffle:/", "/:nono:/", "/:maniac:/", "/:privet:/", "/:ok:/", "/:ninja:/", "/:pif:/", "/:smash:/", "/:alien:/", "/:pirate:/", "/:gun:/", "/:trup:/", "/:mdr:/", "/:sneeze:/", "/:mad:/", "/:friday:/", "/:cry:/", "/:grust:/", "/:rupor:/", "/:fie:/", "/:nnn:/", "/:row:/", "/:red:/", "/:lick:/", "/:help:/", "/:wink:/", "/:jeer:/", "/:tease:/", "/:kruger:/", "/:girl:/", "/:Knight1:/", "/:rev:/", "/:smile100:/", "/:smile118:/", "/:smile149:/", "/:smile166:/", "/:smile237:/", "/:smile245:/", "/:smile28:/", "/:smile289:/", "/:smile314:/", "/:smile36:/", "/:smile39:/", "/:smile44:/", "/:smile70:/", "/:smile87:/", "/:smile434:/", "/:vamp:/"];
$smiles2 = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""];
preg_match_all("/\[(.*)\]/U", $_GET['text'], $matches);
$_GET['text'] = preg_replace($smiles, $smiles2, $_GET['text'], 3);
$_GET['text'] = tolink($_GET['text']);
if ($user['invis'] == 1) {
$tme = db::c()->query("SELECT `time` FROM `effects` WHERE `owner` = '$user[id]' AND `type` = '1022'")->fetch_assoc();
$user['login'] = 'невидимка ' . substr($tme[0], strlen($tme[0]) - 4) . '';
}
# Понять бы какого чёрта условия два… Инс.
if ($action != 1) {
$file = 'tmp/chat.txt';
if (filesize("tmp/chat.txt") > 100 * 1024) {
$line = "\r\n:[" . time() . "]:[{$user['login']}]:[" . ($_GET['text']) . "]:[" . $user->room . "]\r\n";
// Пишем содержимое в файл,
// используя флаг FILE_APPEND flag для дописывания содержимого в конец файла
// и флаг LOCK_EX для предотвращения записи данного файла кем-нибудь другим в данное время
// а то заебали устаревшие функции использовать. Инс.
file_put_contents($file, $line, FILE_APPEND | LOCK_EX);
echo "1";
} else {
$line = ":[" . time() . "]:[{$user['login']}]:[" . ($_GET['text']) . "]:[" . $user->room . "]\r\n";
file_put_contents($file, $line, FILE_APPEND | LOCK_EX);
echo "2";
}
}
}
die ("");
}
}