Размер файла: 20.13Kb
<?php
include_once "../config.php";
include_once "../inc/inc.php";
include_once "../inc/func.php";
include_once "../inc/user.php";
include_once "../inc/gzip.php";
include_once "../inc/online.php";
include_once "../themes/$theme/index.php";
if ($dostup != '1') {
echo "ПАШШШШШШШОЛНАХУЙ";
include_once "../themes/$theme/foot.php";
exit;
} else {
echo 'Управление форумом<hr>';
if (!isset($act)) {
// echo'<img src="/img/pic/24.gif">Форум<hr>';
if ((!isset($thema)) && (!isset($razd))) {
echo'<img src="/img/pic/24.gif"> [Форум]<hr>';
$query = "SELECT * FROM " . $pref . "forum ORDER BY nomer";
$result = mysql_query($query);
echo '<a href="forum.php?act=addrazd">Добавить раздел</a><br>';
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo '<div class="b">';
echo'<a href="forum.php?razd=' . $line['id'] . '">' . $line['name'] . '</a>';
if ($line['pravila'] != '') {
echo ' [<a href="forum.php?act=pravila&r=' . $line['id'] . '">правила раздела</a>]<br>';
} else {
echo '<br>';
}
echo '<small>' . $line['opis'] . '</small><br><a href="forum.php?act=editrazd&razd=' . $line['id'] . '">[edit]</a>|<a href="forum.php?act=delrazd&razd=' . $line['id'] . '">[del]</a></div>';
// $soob=smile($line[msg]);
echo '<a href="forum.php?thema=' . $line['last_theme_id'] . '">' . $line['last_theme'] . '</a> - <a href="/setting/anketa.php?id=' . $line['last_autor_id'] . '">' . $line['last_autor'] . '</a><br>';
echo '<small>[' . $line['last_time'] . ']</small><br><hr>';
// echo '['.$line['ip'].' - '.$line['brow'].']<br>';
}
} else {
if (isset($razd)) {
$razd = (int)$razd;
if ($razd == 0) {
echo'Произошла ошибка. <a href="forum.php">Форум</a>';
include_once "../themes/$theme/foot.php";
exit;
}
// echo'<img src="/img/pic/24.gif"> [<a href="forum.php">Форум</a>/]<hr>';
// echo'Выводим список тем'.$razd;
$query = "SELECT id FROM " . $pref . "forum WHERE id=" . $razd;
$res = mysql_query($query);
$res = implode(mysql_fetch_array($res, MYSQL_ASSOC));
if ($res == '') {
echo 'Произошла ошибка. <a href="forum.php">Форум</a>';
include_once "../themes/$theme/foot.php";
exit;
}
$query = "SELECT name FROM " . $pref . "forum WHERE id=" . $razd;
$nazva = mysql_fetch_array(mysql_query($query));
echo'<img src="/img/pic/24.gif"> [<a href="forum.php">Форум</a>/' . $nazva[0] . ']<br>';
if ($kto == 'user') {
echo'<a href="forum.php?act=addthema&razd=' . $razd . '">Создать тему</a>';
}
echo'<hr>';
$vsego = mysql_num_rows(mysql_query("SELECT * FROM " . $pref . "tema WHERE in_razd=" . $razd));
$pagevsego = $vsego / $kolforum_thema;
$pagevsego = (int)$pagevsego;
$bbb = $vsego - ($pagevsego * $kolforum_thema);
if ($bbb > 0) {
$pagevsego++;
}
$page = (int)$page;
if ($page >= $pagevsego) {
$page = $pagevsego;
}
if ((!isset($page)) || ($page <= 0) || ($page == '')) {
$page = 1;
$start = 0;
} else {
$start = ($page * $kolforum_thema) - $kolforum_thema;
}
$query = "SELECT * FROM " . $pref . "tema WHERE in_razd=" . $razd . " ORDER BY data_last_post DESC LIMIT $start, $kolforum_thema";
$result = mysql_query($query);
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo '<div class="b"><a href="forum.php?act=edittheme&thema=' . $line['id'] . '">[edit]</a>|<a href="forum.php?act=deltheme&thema=' . $line['id'] . '">[del]</a>Тема: <a href="forum.php?thema=' . $line['id'] . '">' . $line['name_tema'] . '</a> [' . $line['all_post'] . ']</div>';
// $soob=smile($line[msg]);
echo 'Автор: <a href="/setting/anketa.php?id=' . $line['first_post_id'] . '">' . $line['first_post'] . '</a> [' . date("h:i / d-m-y", $line['data_first']) . ']<br>';
echo 'Последнее: <a href="/setting/anketa.php?id=' . $line['last_post_id'] . '">' . $line['last_post'] . '</a> [' . date("h:i / d-m-y", $line['data_last']) . ']<br>';
}
echo '<hr>Страницы:<br>';
if ($page == '1') {
echo'<-Назад';
} else {
$ggg = $page-1;
echo '<a href="forum.php?page=' . $ggg . '&razd=' . $razd . '"><-Назад</a>';
}
echo ' [' . $page . ' из ' . $pagevsego . '] ';
if (($page == $pagevsego) || ($pagevsego == 0)) {
echo 'Вперёд-><br>';
} else {
$ggg = $page + 1;
echo '<a href="forum.php?page=' . $ggg . '&razd=' . $razd . '">Вперёд-></a><br>';
}
echo '<form action="forum.php" method="get">';
echo '<input name="razd" type="hidden" value="' . $razd . '">';
echo '<input name="page" type="text" value=""><input type="submit" value=">>">';
echo '</form>';
echo '<hr>Всего тем: ' . $vsego;
} else {
if (isset($thema)) {
$thema = (int)$thema;
if ($thema == 0) {
echo'Произошла ошибка. <a href="forum.php">Форум</a>';
include_once "../themes/$theme/foot.php";
exit;
}
// echo'<img src="/img/pic/24.gif"> [<a href="forum.php">Форум</a>/]<hr>';
// echo'Выводим посты';
$query = "SELECT id FROM " . $pref . "tema WHERE id=" . $thema;
$res = mysql_query($query);
$res = implode(mysql_fetch_array($res, MYSQL_ASSOC));
if ($res == '') {
echo 'Произошла ошибка. <a href="forum.php">Форум</a>';
include_once "../themes/$theme/foot.php";
exit;
}
if ($info == 'postok') {
$page = 100000;
}
$query = "SELECT * FROM " . $pref . "tema WHERE id=" . $thema;
$liner = mysql_fetch_array(mysql_query($query));
$in_razd = $liner['in_razd'];
$query = "SELECT name FROM " . $pref . "forum WHERE id=" . $in_razd;
$nazva = mysql_fetch_array(mysql_query($query));
echo'<img src="/img/pic/24.gif"> [<a href="forum.php">Форум</a>/<a href="forum.php?razd=' . $in_razd . '">' . $nazva[0] . '</a>/' . $liner['name_tema'] . ']';
if ($info == 'postok') {
echo '<center><font color="red">Сообщение добавлено</font></center>';
}
if ($info == 'themaok') {
echo '<center><font color="red">Тема добавлена</font></center>';
}
echo'<hr>';
$query1 = "SELECT * FROM " . $pref . "tema WHERE id=" . $thema;
$result1 = mysql_fetch_array(mysql_query($query1));
$ids = (int)$result1['tema_nomer'];
$vsego = mysql_num_rows(mysql_query("SELECT * FROM " . $pref . "tema_random_" . $ids));
$pagevsego = $vsego / $kolforum_post;
$pagevsego = (int)$pagevsego;
$bbb = $vsego - ($pagevsego * $kolforum_post);
if ($bbb > 0) {
$pagevsego++;
}
$page = (int)$page;
if ($page >= $pagevsego) {
$page = $pagevsego;
}
if ((!isset($page)) || ($page <= 0) || ($page == '')) {
$page = 1;
$start = 0;
} else {
$start = ($page * $kolforum_post) - $kolforum_post;
}
$query = "SELECT * FROM " . $pref . "tema_random_" . $ids . " LIMIT $start, $kolforum_post";
$result = mysql_query($query);
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo '<div class="b"><a href="/setting/anketa.php?id=' . $line['id_user'] . '">' . $line['login'] . '</a> [' . $line['datatext'] . ']</div>';
$soob = smile($line[msg]);
echo $soob . '<br>';
echo '[' . $line['ip'] . ' - ' . $line['brow'] . ']<br>';
}
echo '<hr>';
if ($kto == 'guest') {
echo 'Для добавления сообщений вы должны авторизироваться или зарегистрироваться<br>';
}
if ($kto == 'user') {
echo '<form action="addpost.php?thema=' . $thema . '" method="post">';
echo'Сообщение<br>';
echo'<textarea cols="30" rows="5" name="msg" type="text" value=""></textarea><br><br>';
echo'<input type="submit" value="Добавить">';
echo '</form>';
}
echo '<hr>Страницы:<br>';
if ($page == '1') {
echo'<-Назад';
} else {
$ggg = $page-1;
echo '<a href="forum.php?page=' . $ggg . '&thema=' . $thema . '"><-Назад</a>';
}
echo ' [' . $page . ' из ' . $pagevsego . '] ';
if (($page == $pagevsego) || ($pagevsego == 0)) {
echo 'Вперёд-><br>';
} else {
$ggg = $page + 1;
echo '<a href="forum.php?page=' . $ggg . '&thema=' . $thema . '">Вперёд-></a><br>';
}
echo '<form action="forum.php" method="get">';
echo '<input name="thema" type="hidden" value="' . $thema . '">';
echo '<input name="page" type="text" value=""><input type="submit" value=">>">';
echo '</form>';
echo '<hr>Всего сообщений: ' . $vsego;
}
}
}
}
if ($act == 'addthema') {
$razd = (int)$razd;
if ($razd == 0) {
echo'Произошла ошибка. <a href="forum.php">Форум</a>';
include_once "../themes/$theme/foot.php";
exit;
}
$query = "SELECT id FROM " . $pref . "forum WHERE id=" . $razd;
$res = mysql_query($query);
$res = implode(mysql_fetch_array($res, MYSQL_ASSOC));
if ($res == '') {
echo 'Произошла ошибка. <a href="forum.php">Форум</a>';
include_once "../themes/$theme/foot.php";
exit;
}
if ($kto == 'guest') {
echo'Вы не можете добавлять темы';
include_once "../themes/$theme/foot.php";
exit;
}
$query = "SELECT name FROM " . $pref . "forum WHERE id=" . $razd;
$nazva = mysql_fetch_array(mysql_query($query));
echo'Добавить тему в раздел ' . $nazva[0];
echo '<form name="" action="addthema.php?razd=' . $razd . '" method="post">';
echo'Название темы:<br>';
echo'<input name="name_thema" type="text" value=""><br>';
echo'Сообщение:<br>';
echo'<textarea cols="30" rows="5" name="msg" type="text" value=""></textarea><br><br>';
echo'<input type="submit" value="Добавить">';
echo'</form>';
echo'<hr><a href="forum.php?razd=' . $razd . '">Назад</a><br>';
}
if ($act == 'pravila') {
$r = (int)$r;
if ((isset($r)) && ($r != '') && ($r != 0)) {
$query = "SELECT pravila FROM " . $pref . "forum WHERE id=" . $r;
$res = mysql_query($query);
$res = implode(mysql_fetch_array($res, MYSQL_ASSOC));
if ($res == '') {
echo 'Произошла ошибка<br><a href="forum.php">Форум</a><br>';
include_once "../themes/$theme/foot.php";
exit;
} else {
$query2 = "SELECT name FROM " . $pref . "forum WHERE id=" . $r;
$res2 = mysql_query($query2);
$res2 = implode(mysql_fetch_array($res2, MYSQL_ASSOC));
echo 'Правила форума для раздела <font color="red">' . $res2 . '</font><br>';
echo $res . '<br><a href="forum.php">Форум</a><br>';
}
} else {
echo 'Произошла ошибка<br><a href="forum.php">Форум</a><br>';
include_once "../themes/$theme/foot.php";
exit;
}
}
if ($act == 'editrazd') {
$razd = (int)$razd;
if ($razd == 0) {
echo'Произошла ошибка. <a href="forum.php">Форум</a>';
include_once "../themes/$theme/foot.php";
exit;
}
$query = "SELECT id FROM " . $pref . "forum WHERE id=" . $razd;
$res = mysql_query($query);
$res = implode(mysql_fetch_array($res, MYSQL_ASSOC));
if ($res == '') {
echo 'Произошла ошибка. <a href="forum.php">Форум</a>';
include_once "../themes/$theme/foot.php";
exit;
}
$query = "SELECT name FROM " . $pref . "forum WHERE id=" . $razd;
$nazva = mysql_fetch_array(mysql_query($query));
echo'Редактирование раздела <font color="red">' . $nazva[0] . '</font><br>';
$query = "SELECT * FROM " . $pref . "forum WHERE id=" . $razd;
$resultat = mysql_fetch_array(mysql_query($query));
echo '<form name="" action="editrazd.php" method="post">';
echo '<input name="razd" type="hidden" value="' . $razd . '">';
echo 'Название раздела:<br>';
echo '<input name="naz" type="text" value="' . $resultat['name'] . '"><br>';
echo 'Описание раздела:<br>';
echo'<textarea cols="30" rows="5" name="opis" type="text" value="">' . $resultat['opis'] . '</textarea><br>';
// echo '<input name="opis" type="text" value="'.$resultat['opis'].'"><br>';
echo 'Правила раздела:<br>';
echo'<textarea cols="30" rows="5" name="pravila" type="text" value="">' . $resultat['pravila'] . '</textarea><br><br>';
// echo '<input name="pravila" type="text" value="'.$resultat['pravila'].'"><br><br>';
echo '<input type="submit" value="Изменить">';
echo '</form>';
}
if ($act == 'delrazd') {
$razd = (int)$razd;
if ($razd == 0) {
echo'Произошла ошибка. <a href="forum.php">Форум</a>';
include_once "../themes/$theme/foot.php";
exit;
}
$query = "SELECT id FROM " . $pref . "forum WHERE id=" . $razd;
$res = mysql_query($query);
$res = implode(mysql_fetch_array($res, MYSQL_ASSOC));
if ($res == '') {
echo 'Произошла ошибка. <a href="forum.php">Форум</a>';
include_once "../themes/$theme/foot.php";
exit;
}
$query = "SELECT name FROM " . $pref . "forum WHERE id=" . $razd;
$nazva = mysql_fetch_array(mysql_query($query));
echo 'Вы уверены, что хотите удалить раздел <font color="red">' . $nazva[0] . '?</font><br>';
echo '[<a href="forum.php">НЕТ</a>] [<a href="delrazd.php?razd=' . $razd . '">Да</a>]<br>';
}
if ($act == 'addrazd') {
echo 'Добавить раздел';
echo '<form name="" action="addrazd.php" method="post">';
echo 'Название раздела:<br>';
echo '<input name="naz" type="text" value=""><br>';
echo 'Описание раздела:<br>';
echo'<textarea cols="30" rows="5" name="opis" type="text" value=""></textarea><br>';
// echo '<input name="opis" type="text" value="'.$resultat['opis'].'"><br>';
echo 'Правила раздела:<br>';
echo'<textarea cols="30" rows="5" name="pravila" type="text" value=""></textarea><br><br>';
// echo '<input name="pravila" type="text" value="'.$resultat['pravila'].'"><br><br>';
echo '<input type="submit" value="Добавить">';
echo '</form>';
}
if ($act == 'deltheme') {
$thema = (int)$thema;
if ($thema == 0) {
echo'Произошла ошибка. <a href="forum.php">Форум</a>';
include_once "../themes/$theme/foot.php";
exit;
}
// echo'<img src="/img/pic/24.gif"> [<a href="forum.php">Форум</a>/]<hr>';
// echo'Выводим посты';
$query = "SELECT id FROM " . $pref . "tema WHERE id=" . $thema;
$res = mysql_query($query);
$res = implode(mysql_fetch_array($res, MYSQL_ASSOC));
if ($res == '') {
echo 'Произошла ошибка. <a href="forum.php">Форум</a>';
include_once "../themes/$theme/foot.php";
exit;
}
echo 'Вы уверены, что хотите удалить тему?<br>';
echo '[<a href="forum.php">НЕТ</a>] [<a href="delthema.php?thema=' . $thema . '">Да</a>]';
}
if ($act == 'edittheme') {
$thema = (int)$thema;
if ($thema == 0) {
echo'Произошла ошибка. <a href="forum.php">Форум</a>';
include_once "../themes/$theme/foot.php";
exit;
}
// echo'<img src="/img/pic/24.gif"> [<a href="forum.php">Форум</a>/]<hr>';
// echo'Выводим посты';
$query = "SELECT id FROM " . $pref . "tema WHERE id=" . $thema;
$res = mysql_query($query);
$res = implode(mysql_fetch_array($res, MYSQL_ASSOC));
if ($res == '') {
echo 'Произошла ошибка. <a href="forum.php">Форум</a>';
include_once "../themes/$theme/foot.php";
exit;
}
$query = "SELECT * FROM " . $pref . "tema WHERE id=" . $thema;
$res = mysql_fetch_array(mysql_query($query));
echo '<form name="" action="edittheme.php" method="post">';
echo '<input name="thema" type="hidden" value="' . $thema . '">';
echo '<input name="naz" type="text" value="' . $res['name_tema'] . '"><br><br>';
echo '<input type="submit" value="Изменить">';
echo'</form>';
}
echo '<br><a href="index.php">Админка</a>';
}
include_once "../themes/$theme/foot.php";
?>