Фикс mysql запросов.

This commit is contained in:
Igor Barkov [iwork] 2018-10-31 19:06:17 +02:00
parent f78dbdd75f
commit 24acbd0d87

168
forum.php
View File

@ -2,8 +2,8 @@
session_start();
include('config.php');
$user = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $_SESSION['uid'] . '" LIMIT 1'));
$sleep = mysql_fetch_array(mysql_query('SELECT `id` FROM `effects` WHERE `owner` = "' . $user['id'] . '" AND `time` > "' . time() . '" AND `type` = "3" LIMIT 1'));
$user = db::c()->query('SELECT * FROM `users` WHERE `id` = ?i', $_SESSION['uid'])->fetch_assoc();
$sleep = db::c()->query('SELECT `id` FROM `effects` WHERE `owner` = ?i AND `time` > ?i AND `type` = 3', $user['id'], time())->fetch_assoc();
if (!isset($_GET['page'])) {
$ps = 0;
@ -11,9 +11,9 @@ if (!isset($_GET['page'])) {
$ps = $_GET['page'];
}
$dostupPal = false;
$dostupSovet = false;
if (($user['align'] >= 1.7 && $user['align'] < 2) || $user['align'] == 2.4) {
$dostupPal = true;
}
@ -107,8 +107,8 @@ if (isset($_GET['topic']) && is_numeric($_GET['topic']) && $_GET['topic'] == 228
<?php
if (isset($_POST['selectt'], $_POST['numt']) && $_POST['selectt'] != '' && $_POST['numt'] != '') {
$AlignTop = mysql_fetch_array(mysql_query('SELECT `min_align`, `max_align` FROM `forum` WHERE `id` = "' . mysql_real_escape_string($_POST['selectt']) . '" LIMIT 1'));
mysql_query('UPDATE `forum` SET `parent` = "' . (int)$_POST['selectt'] . '", `min_align` = "' . mysql_real_escape_string($AlignTop['min_align']) . '" , `max_align` = "' . mysql_real_escape_string($AlignTop['max_align']) . '" WHERE `id` = "' . (int)$_POST['numt'] . '" LIMIT 1');
$AlignTop = db::c()->query('SELECT `min_align`, `max_align` FROM `forum` WHERE `id` = ?i', $_POST['selectt'])->fetch_assoc();
db::c()->query('UPDATE `forum` SET `parent` = ?i, `min_align` = "?s", `max_align` = "?s" WHERE `id` = ?i', $_POST['selectt'], $AlignTop['min_align'], $AlignTop['max_align'], $_POST['numt']);
}
if (!isset($_GET['conf']) && !isset($_GET['topic'])) {
@ -119,8 +119,8 @@ if (isset($_GET['topic']) && is_numeric($_GET['topic']) && $_GET['topic'] == 228
$replasepost = '';
if ((isset($_GET['conf']) && is_numeric($_GET['conf'])) || (isset($_GET['konftop']) && is_numeric($_GET['konftop'])) || $Movemess == 1) {
$data = mysql_query("SELECT * FROM `forum` WHERE `parent` = 0 AND `type` = 1 ORDER BY `id` ASC");
while ($row = mysql_fetch_array($data)) {
$data = db::c()->query('SELECT * FROM `forum` WHERE `parent` = 0 AND `type` = 1 ORDER BY `id` ASC');
while ($row = $data->fetch_assoc()) {
if ($row['id'] == 228043095) {
$news_topic = true;
}
@ -339,29 +339,26 @@ if (isset($_GET['topic']) && is_numeric($_GET['topic']) && $_GET['topic'] == 228
$text2 = htmlspecialchars($_POST['title'], ENT_NOQUOTES, 'utf8');
$text1 = parse_bb_code(preg_replace("/\n/", "<br />", $_POST['text']));
$minmax = mysql_fetch_array(mysql_query("SELECT `min_align`, `max_align` FROM `forum` WHERE `id` = '" . mysql_real_escape_string($_GET['conf']) . "' LIMIT 1"));
$minmax = db::c()->query('SELECT `min_align`, `max_align` FROM `forum` WHERE `id` = ?i', $_GET['conf'])->fetch_assoc();
$min_align = $minmax['min_align'];
$max_align = $minmax['max_align'];
if (!isset($_POST['text']) || !isset($_POST['title']) || $_POST['title'] == "" || $_POST['title'] == " " || $_POST['text'] == "" || $_POST['text'] == " ") {
$error = "<span style='redalert'>Заголовок или текст не могут быть пустыми</span>";
$error = "Заголовок или текст не могут быть пустыми!";
} elseif (($minmax['min_align'] == 0 && $minmax['max_align'] == 0) || ($user['align'] >= $minmax['min_align'] && $user['align'] <= $minmax['max_align']) || $dostupSovet) {
if ($user['invis'] == 1) {
$userPost = '<b>Невидимка</b>';
} else {
$userPost = nick::id($user['id'])->full(1);
}
if ($dostupPal == true) {
$text1 = $text1;
} else {
$text1 = strip_tags($text1, '<b><i><u><code><a><br><img><div>');
}
mysql_query("INSERT INTO `forum` (`type`, `topic`, `text`, `parent`, `author`, `date`, `min_align`, `max_align`, `icon`) VALUES ('2', '" . mysql_real_escape_string($text2) . "', '" . $text1 . "', '" . mysql_real_escape_string($_GET['conf']) . "', '" . $userPost . "', '" . date('d.m.y H:i:s') . "', '" . mysql_real_escape_string($min_align) . "', '" . mysql_real_escape_string($max_align) . "', '" . mysql_real_escape_string($icon) . "')");
$topic_id = mysql_insert_id();
if ($dostupPal == false) $text1 = strip_tags($text1, '<b><i><u><code><a><br><img><div>');
db::c()->query('INSERT INTO `forum` (`type`, `topic`, `text`, `parent`, `author`, `date`, `min_align`, `max_align`, `icon`) VALUES (2,"?s","?s",?i,"?s","?s","?s","?s","?s")', $text2, $text1, $_GET['conf'], $userPost, date('d.m.y H:i:s'), $min_align, $max_align, $icon);
$topic_id = db::c()->getLastInsertId();
unset($_POST['text']);
print "<script>window.location='?conf=" . $_GET['conf'] . "&rnd'</script>";
exit();
} else {
$error = "<font color=red><b>Вы не можете писать в этой конференции</b></font>";
$error = "Вы не можете писать в этой конференции!";
}
unset($_POST['add']);
}
@ -370,14 +367,14 @@ if (isset($_GET['topic']) && is_numeric($_GET['topic']) && $_GET['topic'] == 228
$text2 = htmlspecialchars($_POST['title'], ENT_NOQUOTES, 'utf8');
$text1 = parse_bb_code(preg_replace("/\n/", "<br />", $_POST['text']));
$minmax = mysql_fetch_array(mysql_query("SELECT `min_align`,`max_align`, `close`, `parent` FROM `forum` WHERE `id` = '" . mysql_real_escape_string($_GET['topic']) . "' LIMIT 1"));
$minmax = db::c()->query('SELECT `min_align`,`max_align`, `close`, `parent` FROM `forum` WHERE `id` = ?i', $_GET['topic'])->fetch_assoc();
$min_align = $minmax['min_align'];
$max_align = $minmax['max_align'];
if (!isset($_POST['text']) || $_POST['text'] == "" || $_POST['text'] == " ") {
$error = "<font color=red><b>Текст не может быть пустыми</b></font>";
$error = "Текст не может быть пустыми";
} elseif (!is_numeric($_GET['topic'])) {
$error = "<font color=red><b>Не надо так делать</b></font>";
$error = "Не надо так делать";
}
if (($minmax['min_align'] == 0 && $minmax['max_align'] == 0) || ($user['align'] >= $minmax['min_align'] && $user['align'] <= $minmax['max_align']) && $minmax['close'] == "0" || $dostupSovet) {
@ -391,9 +388,8 @@ if (isset($_GET['topic']) && is_numeric($_GET['topic']) && $_GET['topic'] == 228
$text1 = strip_tags($text1, '<b><i><u><code><a><br><img><div>');
}
mysql_query("INSERT INTO `forum` (`type`, `topic`, `text`, `parent`, `author`, `date`, `min_align`, `max_align`) VALUES ('2', '" . mysql_real_escape_string($text2) . "', '" . $text1 . "', '" . mysql_real_escape_string($_GET['topic']) . "', '" . $userPost . "', '" . date("d.m.y H:i:s") . "', '" . mysql_real_escape_string($min_align) . "', '" . mysql_real_escape_string($max_align) . "')");
mysql_query('UPDATE `forum` SET `updated` = now() WHERE `id` = "' . mysql_real_escape_string($_GET['topic']) . '" LIMIT 1');
db::c()->query('INSERT INTO `forum` (`type`, `topic`, `text`, `parent`, `author`, `date`, `min_align`, `max_align`) VALUES (2,"?s","?s",?i,"?s","?s","?s","?s")', $text2, $text1, $_GET['topic'], $userPost, date('d.m.y H:i:s'), $min_align, $max_align);
db::c()->query('UPDATE `forum` SET `updated` = now() WHERE `id` = ?i', $_GET['topic']);
unset($_POST['text']);
if (isset($_GET['page']) && (int)$_GET['page'] > 0) {
@ -404,15 +400,14 @@ if (isset($_GET['topic']) && is_numeric($_GET['topic']) && $_GET['topic'] == 228
echo '<script>location.href="?topic=' . $_GET['topic'] . '&konftop=' . $minmax['parent'] . $page_num . '&rnd#add_comment_place";</script>';
exit();
} else {
$error = "<font color=red><b>Вы не можете писать в этой конференции</b></font>";
$error = "Вы не можете писать в этой конференции!";
}
unset($_POST['add2']);
}
if (isset($_GET['dp']) && $dostupPal == true) {
if ($_GET['dp'] > 100) {
mysql_query("DELETE FROM `forum` WHERE `id` = '" . mysql_real_escape_string($_GET['dp']) . "' LIMIT 1");
mysql_query("DELETE FROM `forum` WHERE `parent` = '" . mysql_real_escape_string($_GET['dp']) . "'");
db::c()->query('DELETE FROM `forum` WHERE `id` = ?i OR `parent` = ?i', $_GET['dp'], $_GET['dp']);
echo "<script>window.location='?topic=" . $_GET['topic'] . "&page=" . $_GET['page'] . "'</script>";
exit();
}
@ -420,8 +415,7 @@ if (isset($_GET['topic']) && is_numeric($_GET['topic']) && $_GET['topic'] == 228
if (isset($_GET['dt']) && $dostupPal == true) {
if ($_GET['dt'] > 100) {
mysql_query("DELETE FROM `forum` WHERE `id` = '" . mysql_real_escape_string($_GET['dt']) . "' LIMIT 1");
mysql_query("DELETE FROM `forum` WHERE `parent` = '" . mysql_real_escape_string($_GET['dt']) . "'");
db::c()->query('DELETE FROM `forum` WHERE `id` = ?i OR `parent` = ?i', $_GET['dt'], $_GET['dt']);
echo "<script>window.location='?conf=" . $_GET['conf'] . "&rnd'</script>";
exit();
}
@ -438,57 +432,47 @@ if (isset($_GET['topic']) && is_numeric($_GET['topic']) && $_GET['topic'] == 228
}
if (isset($_GET['do']) && $dostupPal == true) {
if ($user['align'] >= 1.7 && $user['align'] < 2) {
$palclose = 'паладином ' . nick::id($user['id'])->full(1);
} elseif ((int)$user['admin'] == 1) {
$palclose = '<b>Администрацией</b>';
}
if ($_GET['do'] == "open") {
mysql_query("UPDATE `forum` SET `close` = '0' WHERE `id` = '" . mysql_real_escape_string($_GET['topic']) . "' LIMIT 1");
db::c()->query('UPDATE `forum` SET `close` = 0 WHERE `id` = "?s"', $_GET['topic']);
echo "<script>window.location='?topic=" . $_GET['topic'] . "&rnd'</script>";
exit();
}
if ($_GET['do'] == "close") {
mysql_query("UPDATE `forum` SET `close` = '1', `closepal` = '<font color=red>Обсуждение закрыто " . $palclose . "</font>' WHERE `id` = '" . mysql_real_escape_string($_GET['topic']) . "' LIMIT 1");
$closeComment = "Обсуждение закрыл " . ($user['admin'] == 1) ? "<b>Администратор</b>" : nick::id($user['id'])->full(1);
db::c()->query('UPDATE `forum` SET `close` = 1, `closepal` = "?s" WHERE `id` = "?s"', $closeComment, $_GET['topic']);
echo "<script>window.location='?topic=" . $_GET['topic'] . "&rnd'</script>";
exit();
}
if ($_GET['do'] == "fix") {
mysql_query("UPDATE `forum` SET `fix` = '1' WHERE `id` = '" . mysql_real_escape_string($_GET['topic']) . "' LIMIT 1");
db::c()->query('UPDATE `forum` SET `fix` = 1 WHERE `id` = "?s"', $_GET['topic']);
echo "<script>window.location='?topic=" . $_GET['topic'] . "&rnd'</script>";
exit();
}
if ($_GET['do'] == "unfix") {
mysql_query("UPDATE `forum` SET `fix` = '0' WHERE `id` = '" . mysql_real_escape_string($_GET['topic']) . "' LIMIT 1");
db::c()->query('UPDATE `forum` SET `fix` = 0 WHERE `id` = "?s"', $_GET['topic']);
echo "<script>window.location='?topic=" . $_GET['topic'] . "&rnd'</script>";
exit();
}
}
if (!isset($_GET['conf'])) {
$row = mysql_fetch_array(mysql_query("SELECT * FROM `forum` WHERE `id` = '" . mysql_real_escape_string($_GET['topic']) . "'"));
if (($row['min_align'] == 0 && $row['max_align'] == 0) || ($user['align'] >= $row['min_align'] && $user['align'] <= $row['max_align']) || $user['align'] == "1.99" || $user['align'] == 2.99) {
$row = db::c()->query('SELECT * FROM `forum` WHERE `id` = "?s"', $_GET['topic'])->fetch_assoc();
if (($row['min_align'] == 0 && $row['max_align'] == 0) || ($user['align'] >= $row['min_align'] && $user['align'] <= $row['max_align']) || $user['admin'] == "1") {
$top = $row['parent'];
$parentCat = mysql_fetch_array(mysql_query("SELECT * FROM `forum` WHERE `id` = '" . $top . "' LIMIT 1"));
$parentCat = db::c()->query('SELECT * FROM `forum` WHERE `id` = ?i', $top)->fetch_assoc();
$icons = $row['icon'];
?>
<div align="center"><br/>
<h3 style="display:inline;text-align:center;border-bottom:dotted 1px #000;">
<a href="forum.php?conf=<?= $top ?>">Конференция "<?= $parentCat['topic'] ?>"</a>
</h3>
<? if ($error != '') {
echo '<center>' . $error . '</center>';
} ?>
<? if (isset($error)) err($error); ?>
</div>
<?
$par_top = mysql_fetch_row(mysql_query("SELECT `closepal`, `id` FROM `forum` WHERE `id` = '" . (int)$_GET['topic'] . "' LIMIT 1"));
$par_top = db::c()->query('SELECT `closepal`, `id` FROM `forum` WHERE `id` = "?s"', $_GET['topic'])->fetch_row();
if (((int)$par_top[1] != 0) || ((int)$_GET['konftop'] > 0)) {
if ($row['close'] == 1) {
$close = "<a href='?topic={$_GET['topic']}&do=open'>Открыть</a>";
@ -513,14 +497,12 @@ if (isset($_GET['topic']) && is_numeric($_GET['topic']) && $_GET['topic'] == 228
';
echo "<select id='seltopic" . $_GET['topic'] . "'>" . $replasepost . "</select> <input type='button' value='Переместить' onClick=\"replasetopic(" . $_GET['konftop'] . ", " . $_GET['topic'] . ")\"></div>";
if (isset($_POST['selectt'], $_POST['numt']) && $_POST['selectt'] != '' && $_POST['numt'] != '') {
$error = "<center><h3>Тема перемещена.</h3><a href='forum.php?topic=" . $_POST['numt'] . "&konftop=" . $_POST['selectt'] . "'>forum.php?topic=" . $_POST['numt'] . "&konftop=" . $_POST['selectt'] . "</a></center>";
$error = "<h3>Тема перемещена.</h3><a href='forum.php?topic=" . $_POST['numt'] . "&konftop=" . $_POST['selectt'] . "'>forum.php?topic=" . $_POST['numt'] . "&konftop=" . $_POST['selectt'] . "</a>";
}
}
$pgs = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `forum` WHERE `parent` = '" . mysql_real_escape_string($_GET['topic']) . "'"));
$pgs = db::c()->query('SELECT count(`id`) FROM `forum` WHERE `parent` = "?s"', $_GET['topic'])->fetch_assoc();
$pgs = $pgs[0] / 20;
if ($pgs > 1) {
echo "<img src=i/ico/news.gif width=\"16\" height=\"16\" /> Страницы : ";
}
if ($pgs > 1) echo "<img src=i/ico/news.gif width=\"16\" height=\"16\" /> Страницы : ";
$pages_str = '';
$page = (int)$_GET['page'] > 0 ? (((int)$_GET['page'] + 1) > $pgs ? ($pgs - 1) : (int)$_GET['page']) : 0;
$page = ceil($page);
@ -538,21 +520,23 @@ if (isset($_GET['topic']) && is_numeric($_GET['topic']) && $_GET['topic'] == 228
$pages_str = $FirstPage . $pages_str . $LastPage;
echo $pages_str;
if ($dostupSovet == true) {
$edit = "<a href=\"javascript:void(0);\" class='contact' id=\"{$row[id]}\"><img src=\"i/forum/edit.png\" /></a>";
}
if ($dostupSovet == true) $edit = "<a href=\"javascript:void(0);\" class='contact' id=\"{$row[id]}\"><img src=\"i/forum/edit.png\" /></a>";
echo "<div class=\"rc6 mBodyBlock\" id=\"leaf{$row['id']}\">
<span class=\"topicTitle\">
<img height=15 src=\"i/forum/icon{$icons}.gif\" width=15 border=0 /><a href='?'>{$row['topic']}</a>
</span>";
echo "<div class=\"auth_str\">" . $row['author'] . "
<div class=\"date_abs\">(" . $row['date'] . ")</div> <a href='#' class='cite' onclick=\"add_cites({$row['id']});\" title=\"Цитата\">
<img src=\"i/forum/icon13.gif\" />
?>
<div class="rc6 mBodyBlock" id="leaf<?= $row['id'] ?>">
<span class="topicTitle">
<img height=15 src="i/forum/icon<?= $icons ?>.gif" width=15 border=0/><a
href='?'><?= $row['topic'] ?></a>
</span>
<div class="auth_str">
"<?= $row['author'] ?>"
<div class="date_abs">("<?= $row['date'] ?>")</div>
<a href='#' class='cite' onclick="add_cites(<?= $row['id'] ?>);" title="Цитата">
<img src="i/forum/icon13.gif"/>
</a>
$edit
";
<?= $edit ?>
<?php
if ($dostupPal == true && $news_topic == false) {
echo " <a href='?topic=" . $_GET['topic'] . "&konftop=" . htmlspecialchars($_GET['conf']) . "&page=" . $_GET['page'] . "&dp=" . $row['id'] . "'><img src='i/clear.gif'></a>";
@ -568,8 +552,9 @@ if (isset($_GET['topic']) && is_numeric($_GET['topic']) && $_GET['topic'] == 228
$sort_type = 'DESC';
}
$data = mysql_query("SELECT * FROM `forum` WHERE `parent` = '" . mysql_real_escape_string($_GET['topic']) . "' ORDER by `id` {$sort_type} LIMIT " . (int)($_GET['page'] * 20) . ",20");
while ($row = mysql_fetch_array($data)) {
#$data = mysql_query("SELECT * FROM `forum` WHERE `parent` = '" . mysql_real_escape_string($_GET['topic']) . "' ORDER by `id` {$sort_type} LIMIT " . (int)($_GET['page'] * 20) . ",20");
$data = db::c()->query('SELECT * FROM `forum` WHERE `parent` = "?s" ORDER BY "?s" LIMIT ?i,20', $_GET['topic'], $sort_type, ($_GET['page'] * 20);
while ($row = $data->fetch_assoc()) {
echo "<div class=\"rc6 mBodyBlock\" id=\"leaf{$row['id']}\"><div ><div class=\"mesTopBar\">
<table width=\"100%\" >
<tr>
@ -611,13 +596,13 @@ if (isset($_GET['topic']) && is_numeric($_GET['topic']) && $_GET['topic'] == 228
echo "<br /><div align=center>" . $closepal . "</div><br /><br />";
} else {
if ($user['align'] == 4 && $_GET['conf'] != 23) {
$error = "<br /><br /><center><b>Персонажам со склонностью хаос запрещено писать на этом форуме!</b></center><br /><br />";
$error = "<br /><br /><b>Персонажам со склонностью хаос запрещено писать на этом форуме!</b><br /><br />";
} elseif ($user['baned'] == 1) {
$error = "<br /><br /><center><b>Заблокированным персонажам запрещено писать на форуме!</b></center><br /><br />";
$error = "<br /><br /><b>Заблокированным персонажам запрещено писать на форуме!</b><br /><br />";
} elseif ($user['level'] < 2) {
$error = "<br /><br /><center><b>Персонажам до 2-го уровня запрещено писать на форуме!</b></center><br /><br />";
$error = "<br /><br /><b>Персонажам до 2-го уровня запрещено писать на форуме!</b><br /><br />";
} elseif (isset($sleep['id'])) {
$error = "<br /><br /><center><b>Персонажам с заклинанием форумного молчания запрещено писать на форуме!</b></center><br /><br />";
$error = "<br /><br /><b>Персонажам с заклинанием форумного молчания запрещено писать на форуме!</b><br /><br />";
} elseif ($user['level'] > 1 && !isset($sleep['id'])) {
?>
<a name="add_comment_place"></a>
@ -679,7 +664,7 @@ if (isset($_GET['topic']) && is_numeric($_GET['topic']) && $_GET['topic'] == 228
}
}
} else {
if (is_numeric($_GET['conf']) && $row = mysql_fetch_array(mysql_query("SELECT * FROM `forum` WHERE `id` = '" . mysql_real_escape_string($_GET['conf']) . "'"))) {
if (is_numeric($_GET['conf']) && $row = db::c()->query('SELECT * FROM `forum` WHERE `id` = ?i', $_GET['conf'])->fetch_assoc()) {
if (($row['min_align'] == 0 && $row['max_align'] == 0) || ($user['align'] >= $row['min_align'] && $user['align'] <= $row['max_align']) || $dostupSovet) {
?>
<td rowspan="2" style="padding-left: 10">
@ -688,10 +673,7 @@ if (isset($_GET['topic']) && is_numeric($_GET['topic']) && $_GET['topic'] == 228
<? $confname = 'Конференция "' . $row['topic'] . '"'; ?>
<h3 style="display:inline;text-align:center;padding-left:50px;"><?= $confname ?></h3><br/>
<? if ($error != '') {
echo '<center>' . $error . '</center>';
} ?>
<?
<? if (isset($error)) err($error);
if ($row['parent'] == 0) {
echo $row['text'];
@ -699,7 +681,7 @@ if (isset($_GET['topic']) && is_numeric($_GET['topic']) && $_GET['topic'] == 228
echo '<br />';
$pgs = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `forum` WHERE `parent` = '" . mysql_real_escape_string($_GET['conf']) . "' ORDER BY `fix` DESC, `updated` DESC;"));
$pgs = db::c()->query('SELECT count(`id`) FROM `forum` WHERE `parent` = ?i ORDER BY `fix` DESC, `updated` DESC', $_GET['conf'])->fetch_assoc();
$pgs = $pgs[0] / 20;
$pages_str = '';
$page = (int)$_GET['page'] > 0 ? (((int)$_GET['page'] + 1) > $pgs ? ($pgs - 1) : (int)$_GET['page']) : 0;
@ -731,20 +713,22 @@ if (isset($_GET['topic']) && is_numeric($_GET['topic']) && $_GET['topic'] == 228
</tr>
</table>
<?php
$data = mysql_query("SELECT * FROM `forum` WHERE `parent` = '" . mysql_real_escape_string($_GET['conf']) . "' ORDER BY `fix` DESC, `updated` DESC LIMIT " . (INT)($_GET['page'] * 20) . ",20;");
while ($row = mysql_fetch_array($data)) {
#$data = mysql_query("SELECT * FROM `forum` WHERE `parent` = '" . mysql_real_escape_string($_GET['conf']) . "' ORDER BY `fix` DESC, `updated` DESC LIMIT " . (INT)($_GET['page'] * 20) . ",20;");
$data = db::c()->query('SELECT * FROM `forum` WHERE `parent` = "?s" ORDER BY `fix` DESC, `updated` DESC LIMIT ?i,20', $_GET['conf'], ($_GET['page'] * 20));
while ($row = $data->fetch_assoc()) {
$logi = '';
$userlist = '';
$icons = $row['icon'];
$data2 = mysql_query("SELECT `author` FROM (SELECT `author`,`id` FROM `forum` WHERE `parent` = '" . mysql_real_escape_string($row['id']) . "' ORDER BY `id` DESC LIMIT 10) AS sTable ORDER BY id DESC LIMIT 1;");
while ($row2 = mysql_fetch_array($data2)) {
#$data2 = mysql_query("SELECT `author` FROM (SELECT `author`,`id` FROM `forum` WHERE `parent` = '" . mysql_real_escape_string($row['id']) . "' ORDER BY `id` DESC LIMIT 10) AS sTable ORDER BY id DESC LIMIT 1;");
$data2 = db::c()->query('SELECT `author` FROM (SELECT `author`,`id` FROM `forum` WHERE `parent` = ?i ORDER BY `id` DESC LIMIT 10) AS sTable ORDER BY id DESC', $row['id']);
while ($row2 = $data2->fetch_assoc()) {
$userlist = strip_tags($row2[0], "");
list ($username, $level) = split(" \[", $userlist);
$logi .= $username;
}
$datacount = mysql_fetch_array(mysql_query("SELECT count(*) AS CountNumber FROM `forum` WHERE `parent` = '" . mysql_real_escape_string($row['id']) . "';"));
$datacount = db::c()->query('SELECT count(*) AS CountNumber FROM `forum` WHERE `parent` = ?i', $row['id'])->fetch_assoc();
$count = $datacount["CountNumber"];
$lasttimedb = mysql_fetch_array(mysql_query("SELECT `date` FROM `forum` WHERE `parent` = '" . mysql_real_escape_string($row['id']) . "' ORDER BY `id` DESC LIMIT 1;"));
$lasttimedb = db::c()->query('SELECT `date` FROM `forum` WHERE `parent` = ?i ORDER BY `id` DESC', $row['id'])->fetch_assoc();
$lasttime = $lasttimedb['date'];
echo "<div class=\"mBodyBlock rounded rc6\">
<p class=pleft>" . ($row['fix'] ? "<IMG src=\"i/ico/fixed.gif\" alt=\"Закреплено\" title=\"Закреплено\" border=0> " : "") . "<a href='?topic=" . $row['id'];
@ -752,7 +736,7 @@ if (isset($_GET['topic']) && is_numeric($_GET['topic']) && $_GET['topic'] == 228
echo "&konftop=" . $_GET['conf'];
}
$pgs1 = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `forum` WHERE `parent` = '" . mysql_real_escape_string($row['id']) . "';"));
$pgs1 = db::c()->query('SELECT count(`id`) FROM `forum` WHERE `parent` = ?i', $row['id'])->fetch_assoc();
$pgs1 = $pgs1[0] / 20;
$pages_str1 = '';
$page1 = (int)$_GET['page'] > 0 ? (((int)$_GET['page'] + 1) > $pgs ? ($pgs - 1) : (int)$_GET['page']) : 0;
@ -785,13 +769,13 @@ if (isset($_GET['topic']) && is_numeric($_GET['topic']) && $_GET['topic'] == 228
if ($user['align'] == 4 && $_GET['conf'] != 23) {
$error = "<br /><br /><center><b>Персонажам со склонностью хаос запрещено писать на этом форуме!</b></center><br /><br />";
$error = "<br /><br /><b>Персонажам со склонностью хаос запрещено писать на этом форуме!</b><br /><br />";
} elseif ($user['baned'] == 1) {
$error = "<br /><br /><center><b>Заблокированным персонажам запрещено писать на форуме!</b></center><br /><br />";
$error = "<br /><br /><b>Заблокированным персонажам запрещено писать на форуме!</b><br /><br />";
} elseif ($user['level'] < 2) {
$error = "<br /><br /><center><b>Персонажам до 4-го уровня запрещено писать на форуме!</b></center><br /><br />";
$error = "<br /><br /><b>Персонажам до 4-го уровня запрещено писать на форуме!</b><br /><br />";
} elseif (isset($sleep['id'])) {
$error = "<br /><br /><center><b>Персонажам с заклинанием форумного молчания запрещено писать на форуме!</b></center><br /><br />";
$error = "<br /><br /><b>Персонажам с заклинанием форумного молчания запрещено писать на форуме!</b><br /><br />";
} elseif ($user['level'] > 1 && !isset($sleep['id'])) {
@ -807,7 +791,8 @@ if (isset($_GET['topic']) && is_numeric($_GET['topic']) && $_GET['topic'] == 228
<tr>
<td colspan="2">
<h4>Добавить свой вопрос в форум</h4>
<input type="text" class="inup" name="title" size="57" maxlength="65" placeholder="Тема сообщения">
<input type="text" class="inup" name="title" size="57" maxlength="65"
placeholder="Тема сообщения">
</td>
</tr>
<tr>
@ -817,7 +802,8 @@ if (isset($_GET['topic']) && is_numeric($_GET['topic']) && $_GET['topic'] == 228
onselect="storeCaret(this);"
onclick="storeCaret(this);"
onkeyup="storeCaret(this);"
onchange="storeCaret(this);" placeholder="Введите сообщение..."></textarea>
onchange="storeCaret(this);"
placeholder="Введите сообщение..."></textarea>
<input type=hidden value=0 name=n>
<input type=hidden value=1025804759 name=id>
<input type=hidden name=redirect>