Файл: vkollektive2014/forum.php
Строк: 796
<?
require('connect.php');
if(!$u['id']){
header ("Location: /registration.php?err=1");
exit;
}
$location = '(Сидит на форуме)';
switch(@$_GET['act'])
{
//~~~~~~~~~~Создание категории~~~~~~~~~~~~//
case 'add_cat':
if ($u['admin'] == 1 || $u['admin'] == 2 || $u['admin'] == 3) {
$flood = mysql_query("SELECT `time` FROM `forum_categories` WHERE `user` = '".$u['id']."' AND `time` > '" . (time() - $system['cat_forum_antiflud']) . "'");
if (mysql_num_rows($flood)) {
require('head.php');
error(' <b>Ошибка</b>!</br> Можно добавлять категории только раз в '.$system['cat_forum_antiflud'].' сек.');
header("Refresh: 3; URL=forum.php");
require('foot.php');
exit;
}
if (isset($_POST['submit']) and $_POST['name']) {
$name = check(substr($_POST['name'], 0, 100));
$opis = check(substr($_POST['opis'], 0, 100));
if (empty($name)){
require('head.php');
error(' Ошибка , так делать нельзя !'); $error = '1';
require('foot.php');
exit;
}
if (empty($error)){
mysql_query("INSERT INTO `forum_categories` SET
`name` = '$name',
`opis` = '$opis',
`user` = '".$u['id']."',
`time` = '".time()."',
`edit` = '".$u['id']."',
`etime` = '".time()."',
`ord` = '0'
");
if($u['sex'] == 'm'){
$action[0] = 'Создал';
} else {
$action[0] = 'Создала';
}
$text = $action[0].' раздел в <a href = "/forum.php">форуме</a>.';
mysql_query("INSERT INTO `admin_jurnal` SET
`user` = '".$u['id']."',
`text` = '$text',
`time` = '".time()."',
`news` = '0',
`forum` = '1',
`diary` = '0',
`chat` = '0',
`blog` = '0',
`foto` = '0',
`ban` = '0',
`edit` = '0',
`new` = '1'
");
header("location: forum.php");
}
} else {
$title = $title.' | Форум';
require('head.php');
echo '<div class="title">';
echo '<img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>Добавить категорию</b>';
echo '</div>';
echo '<div class="div">';
echo '<form action=forum.php?act=add_cat method=post>
Название: 100 символов<br/><textarea cols="20" rows="1" name="name" style="width: 30%;height: 20px;"></textarea><br/>
Описание: 100 символов<br/><textarea cols="20" rows="1" name="opis" ></textarea><br/>
<input type=submit name="submit" value=Добавить class=submit white/ ></form>';
echo '</div>';
require('foot.php');
}
} else {
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>Ошибка</b></div>';
error(' Отказано в доступе !');
require('foot.php');
}
break;
//~~~~~~~~~~~~~~~~~Создание форума~~~~~~~~~~~~~~~~~~~//
case 'add_forum':
if ($u['admin'] == 1 || $u['admin'] == 2 || $u['admin'] == 3) {
$flood = mysql_query("SELECT `time` FROM `forum_forums` WHERE `user` = '".$u['id']."' AND `time` > '" . (time() - $system['cat_forum_antiflud']) . "'");
if (mysql_num_rows($flood)) {
require('head.php');
error(' <b>Ошибка</b>!</br> Можно добавлять форум только раз в '.$system['cat_forum_antiflud'].' сек.');
header("Refresh: 3; URL=forum.php");
require('foot.php');
exit;
}
if(isset($_GET['id'])){
$id=num($_GET['id']);
$req = mysql_query("SELECT * FROM `forum_categories` WHERE `id` = '$id' LIMIT 1");
if (mysql_num_rows($req)) {
$category = mysql_fetch_assoc($req);
}
}
if ($category){
if (isset($_POST['submit']) and $_POST['name']) {
$name = check(substr($_POST['name'], 0, 100));
if (empty($name)){
require('head.php');
error(' Ошибка , так делать нельзя !'); $error = '1';
require('foot.php');
exit;
}
if (empty($error)){
mysql_query("INSERT INTO `forum_forums` SET
`name` = '$name',
`time` = '".time()."',
`edit` = '".$u['id']."',
`etime` = '".time()."',
`user` = '".$u['id']."',
`cat` = '".$category['id']."',
`ord` = '0'
");
if($u['sex'] == 'm'){
$action[0] = 'Создал';
} else {
$action[0] = 'Создала';
}
$text = $action[0].' форум в <a href = "forum.php?act=cat&id='.$category['id'].'">разделе</a>.';
mysql_query("INSERT INTO `admin_jurnal` SET
`user` = '".$u['id']."',
`text` = '$text',
`time` = '".time()."',
`news` = '0',
`forum` = '1',
`diary` = '0',
`chat` = '0',
`blog` = '0',
`foto` = '0',
`ban` = '0',
`edit` = '0',
`new` = '1'
");
header("location: forum.php?act=cat&id=".$category['id']."");
}
} else {
$title = $title.' | Форум';
require('head.php');
$name_cat = $category['name'];
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <a href = "forum.php?act=cat&id='.$category['id'].'">'.$name_cat.'</a> <b>Добавить форум</b></div>';
echo '<div class="div">';
echo '<form action=forum.php?act=add_forum&id='.$id.' method=post>
Название: 100 символов<br/><textarea cols="20" rows="1" name="name"style="width: 30%;height: 20px;""></textarea><br/>
<input type=submit name="submit" value=Добавить class=submit white/ ></form>';
echo '</div>';
require('foot.php');
}
}
} else {
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>Добавить форум</b></div>';
error(' Отказано в доступе !');
require('foot.php');
}
break;
//~~~~~~~~~~~~~~~Создание темы~~~~~~~~~~~~~//
case 'add_theme':
$flood = mysql_query("SELECT `time` FROM `forum_themes` WHERE `user` = '".$u['id']."' AND `time` > '" . (time() - $system['forum_theme']) . "'");
if (mysql_num_rows($flood)) {
require('head.php');
error(' <b>Ошибка</b>!</br> Можно добавлять темы в форуме только раз в '.$system['forum_theme'].' сек.');
header("Refresh: 3; URL=forum.php?");
require('foot.php');
exit;
}
if(isset($_GET['id'])){
$id=num($_GET['id']);
$req = mysql_query("SELECT * FROM `forum_forums` WHERE `id` = '$id' LIMIT 1");
if (mysql_num_rows($req)) {
$forum = mysql_fetch_assoc($req);
}
}
if ($forum){
$cat = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_categories` WHERE `id` = '".$forum['cat']."' LIMIT 1"));
if (isset($_POST['submit']) and $_POST['name'] and $_POST['opis']) {
$name = check(substr($_POST['name'], 0, 100));
$opis = check(substr($_POST['opis'], 0, 50000));
$sex = num($_POST['18']);
$admin = num($_POST['admin']);
if (empty($name)){
require('head.php');
error(' Ошибка , так делать нельзя !'); $error = '1';
require('foot.php');
exit;
}
if (empty($error)){
mysql_query("INSERT INTO `forum_themes` SET
`user` = '".$u['id']."',
`name` = '$name',
`opis` = '$opis',
`18` = '$sex',
`admin` = '$admin',
`time` = '".time()."',
`forum` = '".$forum['id']."',
`cat` = '".$cat['id']."',
`ord` = '".time()."'
");
$id = mysql_insert_id();
mysql_query("UPDATE `users` SET
`stat_forum_themes` = `stat_forum_themes`+1
WHERE `id` = '".$u['id']."'
");
mysql_query("UPDATE `users` SET
`stat_forum_messages` = `stat_forum_messages`+1
WHERE `id` = '".$u['id']."'
");
mysql_query("UPDATE `users` SET `rating` = `rating`+20 WHERE `id` = '".$u['id']."'");
if($u['sex'] == 'm'){
$action[0] = 'Создал';
} else {
$action[0] = 'Создала';
}
$text = $action[0].' тему в <a href = "forum.php?act=theme&id='.$id.'&cat=1">форуме</a>.';
mysql_query("INSERT INTO `lenta` SET
`user` = '".$u['id']."',
`text` = '$text',
`time` = '".time()."',
`forum` = '1',
`blog` = '0',
`foto` = '0',
`diary` = '0',
`comm` = '0'
");
header ("Location: forum.php?act=theme&id=$id");
}
} else {
$name_cat = $cat['name'];
$name_forum = $forum['name'];
$title = $title.' | Форум';
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a>
<a href = "forum.php?act=cat&id='.$cat['id'].'">'.$name_cat.'</a>
<a href = "forum.php?act=forum&id='.$forum['id'].'">'.$name_forum.'</a> <b>Создать тему</b></div>';
echo '<div class="div">';
echo '<form action=forum.php?act=add_theme&id='.$id.' method=post>
Тема: 100 символов<br/><textarea cols="20" rows="1" name="name"style="width: 30%;height: 20px;"></textarea><br/>
Сообщение: 50000 символов<br/><textarea cols="50000" rows="2" name="opis"></textarea><br/>';
echo '</div><div class="div">Внимание! Все материалы эротического содержания, а также содержащие ненормативную лексику должны
в обязательном порядке снабжаться меткой <span style="color:red;">(18+)</span> "Для взрослых".</br>
<span style="color:red;">За нарушение правил, ваш ник может быть заблокирован навсегда.</span>
</div><div class="div">';
echo '<input name="18" type="checkbox" value="1"/> Только для взрослых<br/>';
if($u['admin'] >= 1){
echo '<input name="admin" type="checkbox" value="1"/> Доступ только администраторам и модераторам<br/>';
}
echo '<input type=submit name="submit" value=Создать class=submit white/ ></form>';
}
echo '</div>';
require('foot.php');
}
break;
//~~~~~~~~~~~~~~~~~Редактирование категории~~~~~~~~~~~~//
case 'edit_cat':
$flood = mysql_query("SELECT `etime` FROM `forum_categories` WHERE `edit` = '".$u['id']."' AND `etime` > '" . (time() - $system['cat_edit_forum_antiflud']) . "'");
if (mysql_num_rows($flood)) {
require('head.php');
error(' <b>Ошибка</b>!</br> Можно редактировать категорию только раз в '.$system['cat_edit_forum_antiflud'].' сек.');
header("Refresh: 3; URL=forum.php?");
require('foot.php');
exit;
}
if ($u['admin'] == 1 || $u['admin'] == 2 || $u['admin'] == 3) {
if(isset($_GET['id'])){
$id=num($_GET['id']);
$req = mysql_query("SELECT * FROM `forum_categories` WHERE `id` = '$id' LIMIT 1");
if (mysql_num_rows($req)) {
$cat = mysql_fetch_assoc($req);
}
}
if($cat){
if (isset($_POST['submit']) and isset($_POST['name']) and isset($_POST['opis'])) {
$name = check(substr($_POST['name'], 0, 100));
$opis = check(substr($_POST['opis'], 0, 100));
if (empty($name)){
require('head.php');
error(' Ошибка , так делать нельзя !'); $error = '1';
require('foot.php');
exit;
}
if (empty($error)){
mysql_query("UPDATE `forum_categories` SET
`name` = '$name',
`edit` = '".$u['id']."',
`etime` = '".time()."',
`opis` = '$opis'
WHERE `id` = '$id'
");
if($u['sex'] == 'm'){
$action[0] = 'Отредактировал';
} else {
$action[0] = 'Отредактировала';
}
$text = $action[0].' категорию в <a href = "/forum.php">форуме</a>.';
mysql_query("INSERT INTO `admin_jurnal` SET
`user` = '".$u['id']."',
`text` = '$text',
`time` = '".time()."',
`news` = '0',
`forum` = '1',
`diary` = '0',
`chat` = '0',
`blog` = '0',
`foto` = '0',
`ban` = '0',
`edit` = '0',
`new` = '1'
");
header ("Location: forum.php");
}
} else {
$title = $title.' |Форум';
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>Редактировать категорию</b></div>';
echo '<div class="div">';
$name = $cat['name'];
$opis = $cat['opis'];
echo '<form action="forum.php?act=edit_cat&id='.$id.'" method="post">';
echo 'Название: 100 символов<br/><textarea cols="20" rows="1" name="name" style="width: 30%;height: 20px;">'.$name.'</textarea><br/>';
echo 'Описание: 100 символов<br/><textarea cols="20" rows="3" name="opis" >'.$opis.'</textarea><br/>';
echo '<input type="submit" name="submit" value="Сохранить" class="submit white"/>';
echo '</form>';
}
echo '</div>';
require('foot.php');
} else {
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>Ошибка</b></div>';
error(' Ошибка, такой категории нет !');
require('foot.php');
}
} else {
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>Удалить категорию</b></div>';
error(' Отказано в доступе !');
require('foot.php');
}
break;
//~~~~~~~~~~~~~Удаление категории~~~~~~~~~~~~~~~~~~//
case 'delete_cat':
if ($u['admin'] == 1 || $u['admin'] == 2 || $u['admin'] == 3) {
$flood = mysql_query("SELECT `time` FROM `forum_deleted` WHERE `user` = '".$u['id']."' AND `time` > '" . (time() - $system['deleted_forum_antiflud']) . "'");
if (mysql_num_rows($flood)) {
require('head.php');
error(' <b>Ошибка</b>!</br> Можно удалять категории только раз в '.$system['deleted_forum_antiflud'].' сек.');
header("Refresh: 3; URL=forum.php?");
require('foot.php');
exit;
}
if(isset($_GET['id'])){
$id=num($_GET['id']);
$req = mysql_query("SELECT * FROM `forum_categories` WHERE `id` = '$id' LIMIT 1");
if (mysql_num_rows($req)) {
$cat = mysql_fetch_assoc($req);
}
}
if($cat){
if (isset($_POST['submit'])) {
mysql_query("DELETE FROM `forum_categories` WHERE `id` = '".$cat['id']."'");
mysql_query("DELETE FROM `forum_forums` WHERE `cat` = '".$cat['id']."'");
mysql_query("DELETE FROM `forum_themes` WHERE `cat` = '".$cat['id']."'");
mysql_query("DELETE FROM `forum_messages` WHERE `cat` = '".$cat['id']."'");
mysql_query("INSERT INTO `forum_deleted` SET
`user` = '".$u['id']."',
`time` = '".time()."'
");
if($u['sex'] == 'm'){
$action[0] = 'Удалил';
} else {
$action[0] = 'Удалила';
}
$text = $action[0].' категорию в <a href = "/forum.php">форуме</a>.';
mysql_query("INSERT INTO `admin_jurnal` SET
`user` = '".$u['id']."',
`text` = '$text',
`time` = '".time()."',
`news` = '0',
`forum` = '1',
`diary` = '0',
`chat` = '0',
`blog` = '0',
`foto` = '0',
`ban` = '0',
`edit` = '0',
`new` = '1'
");
header ("Location: forum.php");
} else {
$title = $title.' | Форум';
require('head.php');
$name = $cat['name'];
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <a href = "forum.php?act=cat&id='.$id.'">'.$name.'</a> <b>Удалить категорию</b></div>';
echo '<div class="div">';
echo 'Вы уверены, что хотите удалить категорию <a href = "forum.php?act=cat&id='.$id.'"><b>'.$name.'</b></a> и все находящиеся в ней темы?<br/>';
echo '<form action="forum.php?act=delete_cat&id='.$id.'" method="post">';
echo '<input type="submit" name="submit" value="Да, удалить" class="submit white"/>';
echo '</form></div>';
}
require('foot.php');
} else {
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>Ошибка</b></div>';
error(' Ошибка, такой категории нет !');
require('foot.php');
}
} else {
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>Удалить категорию</b></div>';
error(' Отказано в доступе !');
require('foot.php');
}
break;
//~~~~~~~~~~~~~Редактирование форума~~~~~~~~~~~~~~~~~~//
case 'edit_forum':
$flood = mysql_query("SELECT `etime` FROM `forum_forums` WHERE `edit` = '".$u['id']."' AND `etime` > '" . (time() - $system['edit_forum_antiflud']) . "'");
if (mysql_num_rows($flood)) {
require('head.php');
error(' <b>Ошибка</b>!</br> Можно редактировать форум только раз в '.$system['edit_forum_antiflud'].' сек.');
header("Refresh: 3; URL=forum.php?");
require('foot.php');
exit;
}
if ($u['admin'] == 1 || $u['admin'] == 2 || $u['admin'] == 3) {
if(isset($_GET['id'])){
$id=num($_GET['id']);
$req = mysql_query("SELECT * FROM `forum_forums` WHERE `id` = '$id' LIMIT 1");
if (mysql_num_rows($req)) {
$forum = mysql_fetch_assoc($req);
}
}
if($forum){
$cat = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_categories` WHERE `id` = '".$forum['cat']."' LIMIT 1"));
$name_cat = checkout($cat['name']);
if (isset($_POST['submit']) and $_POST['name']) {
$name = check(substr($_POST['name'], 0, 100));
if (empty($name)){
require('head.php');
error(' Ошибка , так делать нельзя !'); $error = '1';
require('foot.php');
exit;
}
if (empty($error)){
mysql_query("UPDATE `forum_forums` SET
`name` = '$name',
`edit` = '".$u['id']."',
`etime` = '".time()."'
WHERE `id` = '$id'
");
if($u['sex'] == 'm'){
$action[0] = 'Отредактировал';
} else {
$action[0] = 'Отредактировала';
}
$text = $action[0].' форум в <a href = "forum.php?act=cat&id='.$cat['id'].'">категории</a>.';
mysql_query("INSERT INTO `admin_jurnal` SET
`user` = '".$u['id']."',
`text` = '$text',
`time` = '".time()."',
`news` = '0',
`forum` = '1',
`diary` = '0',
`chat` = '0',
`blog` = '0',
`foto` = '0',
`ban` = '0',
`edit` = '0',
`new` = '1'
");
header ("Location: forum.php?act=cat&id=".$cat['id']."");
}
} else {
$title = $title.' | Форум';
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <a href = "forum.php?act=cat&id='.$cat['id'].'">'.$name_cat.'</a> <b>Изменить форум</b></div>';
echo '<div class="div">';
$name = $forum['name'];
echo '<form action="forum.php?act=edit_forum&id='.$id.'" method="post">';
echo 'Название: 100 символов<br/><textarea cols="20" rows="1" name="name" style="width: 30%;height: 30px;">'.$name.'</textarea><br/>';
echo '<input type="submit" name="submit" value="Сохранить" class="submit white"/>';
echo '</form>';
}
require('foot.php');
} else {
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>Ошибка</b></div>';
error(' Ошибка, такого подфорума нет !');
require('foot.php');
}
} else {
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>Изменить форум</b></div>';
error(' Отказано в доступе !');
require('foot.php');
}
break;
//~~~~~~~~~~~~~Удаление форума~~~~~~~~~~//
case 'delete_forum':
if ($u['admin'] == 1 || $u['admin'] == 2 || $u['admin'] == 3) {
$flood = mysql_query("SELECT `time` FROM `forum_deleted` WHERE `user` = '".$u['id']."' AND `time` > '" . (time() - $system['deleted_forum_antiflud']) . "'");
if (mysql_num_rows($flood)) {
require('head.php');
error(' <b>Ошибка</b>!</br> Можно удалять форум только раз в '.$system['deleted_forum_antiflud'].' сек.');
header("Refresh: 3; URL=forum.php?");
require('foot.php');
exit;
}
if(isset($_GET['id'])){
$id=num($_GET['id']);
$req = mysql_query("SELECT * FROM `forum_forums` WHERE `id` = '$id' LIMIT 1");
if (mysql_num_rows($req)) {
$forum = mysql_fetch_assoc($req);
}
}
if($forum){
$cat = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_categories` WHERE `id` = '".$forum['cat']."' LIMIT 1"));
$name_cat = checkout($cat['name']);
if (isset($_POST['submit'])) {
mysql_query("DELETE FROM `forum_forums` WHERE `id` = '".$forum['id']."'");
mysql_query("DELETE FROM `forum_themes` WHERE `forum` = '".$forum['id']."'");
mysql_query("DELETE FROM `forum_messages` WHERE `forum` = '".$forum['id']."'");
if($u['sex'] == 'm'){
$action[0] = 'Удалил';
} else {
$action[0] = 'Удалила';
}
$text = $action[0].' форум в <a href = "forum.php?act=cat&id='.$cat['id'].'">категории</a>.';
mysql_query("INSERT INTO `admin_jurnal` SET
`user` = '".$u['id']."',
`text` = '$text',
`time` = '".time()."',
`news` = '0',
`forum` = '1',
`diary` = '0',
`chat` = '0',
`blog` = '0',
`foto` = '0',
`ban` = '0',
`edit` = '0',
`new` = '1'
");
header ("Location: forum.php?act=cat&id=".$cat['id']."");
} else {
$title = $title.' | Форум';
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <a href = "forum.php?act=cat&id='.$cat['id'].'">'.$name_cat.'</a> <b>Удалить форум</b></div>';
echo '<div class="div">';
$name = $forum['name'];
echo 'Вы уверены, что хотите удалить форум <a href = "forum.php?act=forum&id='.$id.'"><b>'.$name.'</b></a> и все находящиеся в ней темы ?<br/>';
echo '<form action="forum.php?act=delete_forum&id='.$id.'" method="post">';
echo '<input type="submit" name="submit" value="Да, удалить" class="submit white"/>';
echo '</form></div>';
}
require('foot.php');
} else {
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>Ошибка</b></div>';
error(' Ошибка, такого подфорума нет !');
require('foot.php');
}
} else {
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>Удалить форум</b></div>';
error(' Отказано в доступе !');
require('foot.php');
}
break;
//~~~~~~~~~~~Удаление темы~~~~~~~~~~~~~//
case 'delete_theme':
if(isset($_GET['id'])){
$id=num($_GET['id']);
$req = mysql_query("SELECT * FROM `forum_themes` WHERE `id` = '$id' LIMIT 1");
if (mysql_num_rows($req)) {
$tema = mysql_fetch_assoc($req);
}
}
if ($tema){
$cat = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_categories` WHERE `id` = '".$tema['cat']."' LIMIT 1"));
$forum = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_forums` WHERE `id` = '".$tema['forum']."' LIMIT 1"));
$all = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `theme` = '".$tema['id']."'"), 0);
if($u['admin'] == 1 || $u['admin'] == 2 || $u['admin'] == 3){
if (isset($_POST['submit'])) {
mysql_query("DELETE FROM `forum_themes` WHERE `id` = '".$id."'");
mysql_query("DELETE FROM `forum_messages` WHERE `theme` = '".$id."'");
if($u['sex'] == 'm'){
$action[0] = 'Удалил';
} else {
$action[0] = 'Удалила';
}
$text = $action[0].' тему в <a href = "forum.php?act=forum&id='.$forum['id'].'">в форуме</a>.';
mysql_query("INSERT INTO `admin_jurnal` SET
`user` = '".$u['id']."',
`text` = '$text',
`time` = '".time()."',
`news` = '0',
`forum` = '1',
`diary` = '0',
`chat` = '0',
`blog` = '0',
`foto` = '0',
`ban` = '0',
`edit` = '0',
`new` = '1'
");
header ("Location: forum.php?act=forum&id=".$forum['id']."");
} else {
$name_cat = $cat['name'];
$name_forum = $forum['name'];
$name_theme = $tema['name'];
$title = $title.' | Форум';
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <a href = "forum.php?act=cat&id='.$cat['id'].'">'.$name_cat.'</a>
<a href = "forum.php?act=forum&id='.$forum['id'].'">'.$name_forum.'</a> <a href = "forum.php?act=theme&id='.$tema['id'].'">'.$name_theme.'</a></div>';
echo '<div class="div">';
$name = $cat['name'];
echo 'Удалить тему <a href = "forum.php?act=theme&id='.$id.'"><b>'.$name_theme.'</b></a>?<br/>';
echo '<form action="forum.php?act=delete_theme&id='.$id.'" method="post">';
echo '<input type="submit" name="submit" value="Да, удалить" class="submit white"/>';
echo '</form></div>';
require('foot.php');
}
} else {
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>Ошибка</b></div>';
error(' Отказано в доступе !');
require('foot.php');
}
} else {
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>Ошибка</b></div>';
error(' Такой темы нет !');
require('foot.php');
}
break;
//~~~~~~~~~~~~~~Изменение темы~~~~~~~~~~~~~~//
case 'edit_theme':
$flood = mysql_query("SELECT `etime` FROM `forum_themes` WHERE `who` = '".$u['id']."' AND `etime` > '" . (time() - $system['edit_forum_theme']) . "'");
if (mysql_num_rows($flood)) {
require('head.php');
error(' <b>Ошибка</b>!</br> Можно редактировать тему только раз в '.$system['edit_forum_theme'].' сек.');
header("Refresh: 3; URL=forum.php");
require('foot.php');
exit;
}
if(isset($_GET['id'])){
$id=num($_GET['id']);
$req = mysql_query("SELECT * FROM `forum_themes` WHERE `id` = '$id' LIMIT 1");
if (mysql_num_rows($req)) {
$tema = mysql_fetch_assoc($req);
}
}
if ($tema){
$cat = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_categories` WHERE `id` = '".$tema['cat']."' LIMIT 1"));
$forum = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_forums` WHERE `id` = '".$tema['forum']."' LIMIT 1"));
$opis = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_forums` WHERE `id` = '".$tema['forum']."' LIMIT 1"));
$name_cat = $cat['name'];
$name_forum = $forum['name'];
$name_theme = $tema['name'];
$opis = checkout($tema['opis']);
if($tema['user'] == $u['id'] || $u['admin'] == 1 || $u['admin'] == 2 || $u['admin'] == 3){
if (isset($_POST['submit']) and $_POST['name'] and $_POST['opis']) {
$name = check(substr($_POST['name'], 0, 100));
$opis = check(substr($_POST['opis'], 0, 50000));
$sex = num($_POST['18']);
$admin = num($_POST['admin']);
if (empty($name)){
require('head.php');
error(' Ошибка , так делать нельзя !'); $error = '1';
require('foot.php');
exit;
}
if (empty($error)){
mysql_query("UPDATE `forum_themes` SET
`name` = '$name'
WHERE `id` = '".$tema['id']."'
");
mysql_query("UPDATE `forum_themes` SET
`opis` = '$opis',
`18` = '$sex',
`who` = '".$u['id']."'
WHERE `id` = '".$tema['id']."'
");
mysql_query("UPDATE `forum_themes` SET
`cedit` = `cedit`+1
WHERE `id` = '".$tema['id']."'
");
mysql_query("UPDATE `forum_themes` SET
`etime` = '".time()."'
WHERE `id` = '".$tema['id']."'
");
if($u['admin'] >= 1){
mysql_query("UPDATE `forum_themes` SET
`admin` = '$admin'
WHERE `id` = '".$tema['id']."'
");
}
if($u['admin'] == 1 || $u['admin'] == 2 || $u['admin'] == 3){
if($u['sex'] == 'm'){
$action[0] = 'Отредактировал';
} else {
$action[0] = 'Отредактировала';
}
$text = $action[0].' тему в <a href = "forum.php?act=theme&id='.$tema['id'].'"> форуме</a>.';
mysql_query("INSERT INTO `admin_jurnal` SET
`user` = '".$u['id']."',
`text` = '$text',
`time` = '".time()."',
`news` = '0',
`forum` = '1',
`diary` = '0',
`chat` = '0',
`blog` = '0',
`foto` = '0',
`ban` = '0',
`edit` = '0',
`new` = '1'
");
}
header ("Location: forum.php?act=theme&id=".$tema['id']."");
}
} else {
$title = $title.' | Форум';
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <a href = "forum.php?act=theme&id='.$tema['id'].'">'.$name_theme.'</a> <b>Изменить тему</b></div>';
echo '<div class="div">';
$name = $tema['name'];
$opis = $tema['opis'];
echo '<form action="forum.php?act=edit_theme&id='.$id.'" method="post">';
echo 'Тема: 100 символов<br/><textarea cols="20" rows="1" name="name"style="width: 30%;height: 20px;">'.$name.'</textarea><br/>';
echo 'Сообщение: 50000 символов<br/><textarea cols="20" rows="3" name="opis">'.$opis.'</textarea><br/>';
echo '</div><div class="div">Внимание! Все материалы эротического содержания, а также содержащие ненормативную лексику должны
в обязательном порядке снабжаться меткой <span style="color:red;">(18+)</span> "Для взрослых".</br>
<span style="color:red;">За нарушение правил, ваш ник может быть заблокирован навсегда.</span>
</div><div class="div">';
echo '<input name="18" type="checkbox" value="1"' . ($tema["18"] == 1 ? ' checked' : '') . '/> Только для взрослых<br/>';
if($u['admin'] >= 1){
echo '<input name="admin" type="checkbox" value="1"' . ($tema["admin"] == 1 ? ' checked' : '') . '/> Доступ только администраторам и модераторам<br/>';
}
echo '<input type="submit" name="submit" value="Сохранить" class="submit white"/>';
echo '</form></div>';
}
require('foot.php');
} else {
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>Ошибка</b></div>';
error(' Отказано в доступе !');
require('foot.php');
}
} else {
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>Ошибка</b></div>';
error(' Ошибка, такой темы нет !');
require('foot.php');
}
break;
//~~~~~~~~~~~Изменение сообщения~~~~~~~~~~~~~//
case 'edit_message':
$flood = mysql_query("SELECT `etime` FROM `forum_messages` WHERE `user` = '".$u['id']."' AND `etime` > '" . (time() - $system['edit_comm_forum_theme']) . "'");
if (mysql_num_rows($flood)) {
require('head.php');
error(' <b>Ошибка</b>!</br> Можно редактировать сообщение только раз в '.$system['edit_comm_forum_theme'].' сек.');
header("Refresh: 3; URL=forum.php");
require('foot.php');
exit;
}
if(isset($_GET['id'])){
$id=num($_GET['id']);
$req = mysql_query("SELECT * FROM `forum_messages` WHERE `id` = '$id' LIMIT 1");
if (mysql_num_rows($req)) {
$msg = mysql_fetch_assoc($req);
}
}
if ($msg){
$cat = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_categories` WHERE `id` = '".$msg['cat']."' LIMIT 1"));
$forum = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_forums` WHERE `id` = '".$msg['forum']."' LIMIT 1"));
$tema = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_themes` WHERE `id` = '".$msg['theme']."' LIMIT 1"));
$name_cat = $cat['name'];
$name_forum = $forum['name'];
$name_theme = $tema['name'];
if($msg['user'] == $u['id'] || $u['admin'] == 1 || $u['admin'] == 2 || $u['admin'] == 3){
if (isset($_POST['submit']) and $_POST['message']) {
$message = check(substr($_POST['message'], 0, 10000));
if (empty($message)){
require('head.php');
error(' <div class="div"> Ошибка , так делать нельзя !'); $error = '1';
require('foot.php');
exit;
}
if (empty($error)){
mysql_query("UPDATE `forum_messages` SET
`message` = '$message'
WHERE `id` = '".$msg['id']."'
");
mysql_query("UPDATE `forum_messages` SET
`cedit` = `cedit`+1
WHERE `id` = '".$msg['id']."'
");
mysql_query("UPDATE `forum_messages` SET
`etime` = '".time()."'
WHERE `id` = '".$msg['id']."'
");
header ("Location: forum.php?act=theme&id=".$tema['id']."");
}
} else {
$title = $title.' | Форум';
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <a href = "forum.php?act=cat&id='.$cat['id'].'">'.$name_cat.'</a>
<a href = "forum.php?act=forum&id='.$forum['id'].'">'.$name_forum.'</a> <a href = "forum.php?act=theme&id='.$tema['id'].'">'.$name_theme.'</a></div>';
echo '<div class="div">';
$message = $msg['message'];
echo '<form action="forum.php?act=edit_message&id='.$id.'" method="post">';
echo 'Сообщение: 10000 символов<br/><textarea cols="20" rows="3" name="message" style="width: 97%">'.$message.'</textarea><br/>';
echo '<input type="submit" name="submit" value="Сохранить" class="submit white"/>';
echo '</div></form>';
}
require('foot.php');
} else {
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>Ошибка</b></div>';
error(' Отказано в доступе !');
require('foot.php');
}
} else {
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>Ошибка</b></div>';
error(' Ошибка, такого сообщения нет !');
require('foot.php');
}
break;
//~~~~~~~~~~~~~~~~~~~Ответ~~~~~~~~~~~~~//
case 'answer':
if(!$u['id']){
header ("Location: registration.php?err=1");
exit;
}
$flood = mysql_query("SELECT `time` FROM `forum_messages` WHERE `user` = '".$u['id']."' AND `time` > '" . (time() - 10) . "'");
if (mysql_num_rows($flood)) {
require('head.php');
error(' <b>Ошибка</b>!</br> Можно добавлять сообщение только раз в 10 сек.');
header("Refresh: 3; URL=forum.php");
require('foot.php');
exit;
}
if(isset($_GET['id'])){
$id=num($_GET['id']);
$req = mysql_query("SELECT * FROM `forum_messages` WHERE `id` = '$id' LIMIT 1");
if (mysql_num_rows($req)) {
$msg = mysql_fetch_assoc($req);
}
}
if ($msg){
$cat = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_categories` WHERE `id` = '".$msg['cat']."' LIMIT 1"));
$forum = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_forums` WHERE `id` = '".$msg['forum']."' LIMIT 1"));
$tema = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_themes` WHERE `id` = '".$msg['theme']."' LIMIT 1"));
$name_cat = $cat['name'];
$name_forum = $forum['name'];
$name_theme = $tema['name'];
if($msg['user'] == $u['id'] || $tema['close'] == 1) {
require('head.php');
error(' Отказано в доступе !');
require('foot.php');
exit;
}
if (isset($_POST['submit']) and $_POST['message']) {
$message = check(substr($_POST['message'], 0, 10000));
if (empty($message)){
require('head.php');
error(' Ошибка , так делать нельзя !'); $error = '1';
require('foot.php');
exit;
}
if (empty($error)){
mysql_query("INSERT INTO `forum_messages` SET
`user` = '".$u['id']."',
`message` = '$message',
`time` = '".time()."',
`theme` = '".$tema['id']."',
`forum` = '".$forum['id']."',
`cat` = '".$cat['id']."'
");
mysql_query("UPDATE `forum_themes` SET
`ord` = '".time()."'
WHERE `id` = '".$tema['id']."'
");
mysql_query("UPDATE `users` SET
`stat_forum_messages` = `stat_forum_messages`+1
WHERE `id` = '".$u['id']."'
");
if($u['sex'] == 'm'){
$action[0] = 'Прокомментировал';
} else {
$action[0] = 'Прокомментировала';
}
$text = $action[0].' тему в <a href = "forum.php?act=theme&id='.$tema['id'].'&cat=1">форуме</a>.';
mysql_query("INSERT INTO `lenta` SET
`user` = '".$u['id']."',
`text` = '$text',
`time` = '".time()."',
`forum` = '1',
`blog` = '0',
`foto` = '0',
`diary` = '0',
`comm` = '1'
");
if($tema['user'] != $msg['user']) {
if($u['sex'] == 'm'){
$action[0] = 'Оставил';
} else {
$action[0] = 'Оставила';
}
$text = $action[0].' сообщение в вашей <a href = "forum.php?act=theme&id='.$tema['id'].'&cat=1">теме</a>.';
mysql_query("INSERT INTO `jurnal` SET
`user` = '".$tema['user']."',
`outuser` = '".$u['id']."',
`text` = '$text',
`time` = '".time()."',
`new` = '1'
");
}
if($msg['id'] != $u['id']){
if($u['sex'] == 'm'){
$action[0] = 'Ответил';
} else {
$action[0] = 'Ответила';
}
$text = $action[0].' вам в <a href = "forum.php?act=theme&id='.$tema['id'].'&cat=1">форуме</a>.';
mysql_query("INSERT INTO `jurnal` SET
`user` = '".$msg['user']."',
`outuser` = '".$u['id']."',
`text` = '$text',
`time` = '".time()."',
`new` = '1'
");
}
header ("Location: forum.php?act=theme&id=".$tema['id']."");
}
} else {
$title = $title.' | Форум';
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>Ответ</b></div>';
echo '<div class="div">';
echo 'Ответ <a href = "/page.php?id='.$msg['user'].'">'.login($msg['user']).'</a><br/>';
echo '<form action="forum.php?act=answer&id='.$id.'" method="post">';
echo '<textarea cols="20" rows="3" name="message" style="width: 97%">[u]'.login($msg['user']).'[/u] , </textarea><br/>';
echo '<input type="submit" name="submit" value="Сохранить" class="submit white"/>';
echo '<small> 10000 <a href = "smiles.php">Смайлы</a> | <a href = "code.php">BB-коды</a></small>';
echo '</form>';
echo '</div>';
require('foot.php');
}
} else {
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>Ошибка</b></div>';
error(' Ошибка, такого сообщения нет !');
require('foot.php');
}
break;
//~~~~~~~~~~~~~~~~~Просмотр темы~~~~~~~~~~~~~//
case 'theme':
if(isset($_GET['id'])){
$id=num($_GET['id']);
$req = mysql_query("SELECT * FROM `forum_themes` WHERE `id` = '$id' LIMIT 1");
if (mysql_num_rows($req)) {
$tema = mysql_fetch_assoc($req);
}
}
if ($tema){
$cat = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_categories` WHERE `id` = '".$tema['cat']."' LIMIT 1"));
$forum = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_forums` WHERE `id` = '".$tema['forum']."' LIMIT 1"));
$name_cat = $cat['name'];
$name_forum = $forum['name'];
$name_theme = $tema['name'];
$them = checkout($tema['opis']);
if($tema['close'] == 0 and $u['id']){
if(@$_POST['message']){
$message = check(substr($_POST['message'], 0, 10000));
if (empty($message)){
require('head.php');
error(' Ошибка , так делать нельзя !'); $error = '1';
require('foot.php');
exit;
}
$flood = mysql_query("SELECT `time` FROM `forum_messages` WHERE `user` = '".$u['id']."' AND `time` > '" . (time() - 5) . "'");
if (mysql_num_rows($flood)) {
header ("Location: forum.php?act=theme&id=$id");
exit;
}
if (empty($error)){
mysql_query("INSERT INTO `forum_messages` SET
`user` = '".$u['id']."',
`message` = '$message',
`time` = '".time()."',
`theme` = '$id',
`forum` = '".$forum['id']."',
`cat` = '".$cat['id']."'
");
mysql_query("UPDATE `forum_themes` SET
`ord` = '".time()."'
WHERE `id` = '$id'
");
mysql_query("UPDATE `users` SET
`stat_forum_messages` = `stat_forum_messages`+1
WHERE `id` = '".$u['id']."'
");
if($u['sex'] == 'm'){
$action[0] = 'Прокомментировал';
} else {
$action[0] = 'Прокомментировала';
}
$text = $action[0].' тему:<a href = "forum.php?act=theme&id='.$id.'&cat=1">теме</a>.';
mysql_query("INSERT INTO `lenta` SET
`user` = '".$u['id']."',
`text` = '$text',
`time` = '".time()."',
`forum` = '1',
`blog` = '0',
`foto` = '0',
`diary` = '0',
`comm` = '1'
");
if($tema['user'] != $u['id']) {
if($u['sex'] == 'm'){
$action[0] = 'Оставил';
} else {
$action[0] = 'Оставила';
}
$text = $action[0].' сообщение в вашей <a href = "forum.php?act=theme&id='.$id.'&cat=1">теме</a>.';
mysql_query("INSERT INTO `jurnal` SET
`user` = '".$tema['user']."',
`outuser` = '".$u['id']."',
`text` = '$text',
`time` = '".time()."',
`new` = '1'
");
}
header ("Location: forum.php?act=theme&id=$id&");
}
}
}
if($u['admin'] >= 1){
if(@$_GET['del']){
$del = intval($_GET['del']);
$message = mysql_num_rows(mysql_query("SELECT * FROM `forum_messages` WHERE `id` = '$del' and `main` = '0'"));
if($message){
mysql_query("DELETE FROM `forum_messages` WHERE `id` = '$del' LIMIT 1");
header ("Location: forum.php?act=theme&id=$id");
}
}
}
if($u['admin'] == 1 || $u['admin'] == 2 || $u['admin'] == 3){
$close = num(@$_GET['close']);
if($tema['close'] == 0 and $close == 1) {
mysql_query("UPDATE `forum_themes` SET
`close` = '1',
`close_id` = '".$u['id']."'
WHERE `id` = '$id'
");
$tema['close_id'] = $u['id'];
header ("Location: forum.php?act=theme&id=$id");
}
if($tema['close'] == 1 and $close == 2) {
mysql_query("UPDATE `forum_themes` SET
`close` = '0'
WHERE `id` = '$id'
");
$tema['close'] = 0;
}
}
if($u['admin'] == 1 || $u['admin'] == 2 || $u['admin'] == 3){
$fix = num(@$_GET['fix']);
if($tema['fix'] == 0 and $fix == 1) {
mysql_query("UPDATE `forum_themes` SET
`fix` = '1'
WHERE `id` = '$id'
");
header ("Location: forum.php?act=theme&id=$id");
}
if($tema['fix'] == 1 and $fix == 2) {
mysql_query("UPDATE `forum_themes` SET
`fix` = '0'
WHERE `id` = '$id'
");
$tema['fix'] = 0;
}
}
$themeusers = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '".$tema["user"]."'"));
$themeclose = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '".$tema["close_id"]."'"));
$title = $title.' | Форум';
require('head.php');
require('core/bb_code.php');
require('core/panel.php');
echo '<div class="title">';
echo '<img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <a href = "forum.php?act=cat&id='.$cat['id'].'">'.$name_cat.'</a>
<a href = "forum.php?act=forum&id='.$forum['id'].'">'.$name_forum.'</a>
<a href = "'.check($_SERVER['REQUEST_URI']).'"> Обновить</a>';
echo '</div>';
if(@$_GET['cat'] and $tema['18'] == 1) {
echo '<div class="div"> <font color="red">
Внимание! Это содержимое только для взрослых!</font></br>
Нажимая ДА, Вы подтверждаете, что Вам 18 или более лет.</br>
Если Вам менее 18 лет - нажмите НЕТ.</br>
<a href = "forum.php?act=theme&id='.$tema['id'].'">Да</a> |
<a href="?sid=Back" onclick="history.back()">Нет</a>
</div>';
require('foot.php');
exit;
}
if($tema['admin'] == 1 and $u['admin'] == 0) {
error(' Отказано в доступе !');
require('foot.php');
exit;
}
if($tema['user'] == $u['id'] || $u['admin'] == 1 || $u['admin'] == 2 || $u['admin'] == 3) {echo '<div class="nav">';
echo ' <a href = "forum.php?act=edit_theme&id='.$id.'">Изменить</a> ';}
if($u['admin'] == 1 || $u['admin'] == 2 || $u['admin'] == 3) {echo '| <a href = "forum.php?act=delete_theme&id='.$id.'">Удалить</a> |';
if($tema['close'] == 0) {echo ' <a href = "forum.php?act=theme&id='.$id.'&close=1">Закрыть</a> |';
} else { echo ' <a href = "forum.php?act=theme&id='.$id.'&close=2">Открыть</a> |'; }
if($tema['fix'] == 0) {echo ' <a href = "forum.php?act=theme&id='.$id.'&fix=1">Закрепить</a> ';
} else { echo ' <a href = "forum.php?act=theme&id='.$id.'&fix=2">Открепить</a> ';
}
}
if($u['admin'] == 1 || $u['admin'] == 2 || $u['admin'] == 3 and $u['id'] != $tema['user'])echo '| <a href = "adminka.php?act=ban_users&id='.$tema['user'].'"><font color="red">Бан</font></a>';
if($tema['user'] == $u['id'] || $u['admin'] == 1 || $u['admin'] == 2 || $u['admin'] == 3)echo '</div>';
echo '<div class="div">';
echo ''.ico($themeusers['sex'],$themeusers['admin']).' <a href = "/page.php?id='.$tema['user'].'">'.login($tema['user']).'</a> / <span style="font-size: small; color:#209143">'.vremya($tema['time']).'</span> / <b>'.$name_theme.'</b>';
if($tema['close'] == 1) {echo ' <img src="ico/lock.gif" alt="image" /> '; }
if($tema['18'] == 1) { echo ' <font color="red">18+</font> '; }
echo '</br>';
echo ''.img(smile(links(bb_code($them)))).'</div>';
if($tema['cedit'] == 1)echo '<div class="div"><img src="ico/edit.png" alt="!"/> Последний раз редактировалось: <a href = "/page.php?id='.$tema['who'].'">'.login($tema['who']).'</a> ['.vremya($tema['etime']).'] ['.$tema['cedit'].' раз]</div>';
if($themeclose['admin'] == '1' || $themeclose['admin'] == '2'){
$action[0] = 'администратором';
} else {
$action[0] = 'модератором';
}
if($tema['close'] == 1) echo '<div class="title"> Тема закрыта '.$action[0].' <a href = "/page.php?id='.$tema['close_id'].'"><b>'.login($tema['close_id']).'</b></a></div>';
if($u){
if($tema['close'] == 0){
echo '<div class="app">';
if ($u['panel_obw'] == 0) {
echo '' .panel();
}
echo '<form action="forum.php?act=theme&id='.$id.'&del='.@$msg['id'].'" method="post" name="form">';
echo '<textarea cols="20" rows="3" name="message">';
echo '</textarea><br/>';
echo "<input type='submit' title='Нажмите для отправки' name='submit' value='Написать' class='submit white'/> <small>10000 <a href = 'smiles.php'>Смайлы</a>
| <a href = 'code.php'>BB-коды</a></small>
</form></div>";
}
} else {
echo '<div class="zona">Извините, добавление комментариев доступно только зарегистрированным пользователям.
Регистрация быстрая и бесплатная.</div>';
}
$all = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `theme` = '".$tema['id']."'"), 0);
if($all > 0){
$total = num(($all - 1) / 10) + 1;
$page = num(@$_GET['page']);
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * 10 - 10;
echo '<div class="nav">';
echo ' Комментарии: ('.$all.')';
echo '</div>';
if ($all >= 11)echo '<div class="title">';
if ($page != $total) {
echo '<a name="page-up" style="float: right; text-decoration: none;" href="#page-down"><img src = "ico/page_down.png"></a>';
}
$sort = check(@$_GET['sort']);
if($sort == 'message') {
$sortq = 'ASC';
if ($all >= 11)echo '<a href = "forum.php?act=theme&id='.$id.'&sort=time&page='.$page.'">Новые</a> | <b>Поcледние</b>';
}
if($sort == 'time' || empty($sortq)) {
$sort = 'time';
$sortq = 'DESC';
if ($all >= 11)echo '<b>Новые</b> | <a href = "forum.php?act=theme&id='.$id.'&sort=message&page='.$page.'">Поcледние</a>';
}
if ($all >= 11)echo '</div>';
$result = mysql_query("SELECT * FROM `forum_messages` WHERE `theme` = '".$tema['id']."' ORDER BY `time` $sortq LIMIT $start, 10");
while($msg = mysql_fetch_assoc($result)){
$user = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '".$msg["user"]."'"));
$message = checkout($msg['message']);
echo @$i % 2 ? '<div class="div">' : '<div class="div">';
if($tema['user'] == $user['id'])echo '<span style="float: right; font-size: x-small; color: grey">Автор</span>';
if(ban($user['id']) || ($user['delete'] == 1)){
echo ''.ico($user['sex'],$user['admin']).' <a href = "/page.php?id='.$user['id'].'"><del>'.$user['login'].'</del></a> '.online($user['online']).' ';
} else {
echo ''.ico($user['sex'],$user['admin']).' <a href = "/page.php?id='.$user['id'].'">'; echo GradientText("$user[login]", "$user[ncolor]", "$user[ncolor2]"); echo '</a> '.online($user['online']).' ';
}
if($user['rating']>=1000 && $user['rating']<=1999)echo "<img src='ico/b.png' alt='' class='icon'</a>n";
if($user['rating']>=2000 && $user['rating']<=2999)echo "<img src='ico/s.png' alt='' class='icon'</a>n";
if($user['rating']>=3000)echo "<img src='ico/z.png' alt='' class='icon'</a>n";
if($user['stat_forum_messages']>=100)echo "<img src='ico/nagr.png' alt='' class='icon'</a>n";
# if($user['stat_forum_messages']>=150)echo "<img src='ico/nagr.png' alt='' class='icon'</a>n";
# if($user['stat_forum_messages']>=200)echo "<img src='ico/nagr.png' alt='' class='icon'</a>n";
# if($user['stat_forum_messages']>=250)echo "<img src='ico/nagr.png' alt='' class='icon'</a>n";
# if($user['stat_forum_messages']>=1000)echo "<img src='ico/nagr.png' alt='' class='icon'</a>n";
$vip = mysql_fetch_array(mysql_query("SELECT * FROM `vip_users` WHERE `id_user` = '".$user['id']."'"));
if((int)$vip['id'] > 0){ echo " <img src='/style/vip_icons/{$vip['icon']}.gif' />n"; }
echo ' <small>'.vremya($msg['time']).'</small>';
echo '<br/>';
echo ''.img(smile(links(bb_code(censored($message))))).'';
echo '</br>';
echo '<small>';
if($tema['close'] == 0 and $u['id']) {
if($msg['user'] != $u['id']) echo '[<a href = "forum.php?act=answer&id='.$msg['id'].'">Отв</a>]';
}
if($msg['main'] == 0 && $msg['user'] == $u['id']) echo ' [<a href = "forum.php?act=edit_message&id='.$msg['id'].'">Ред</a>] ';
if($u['admin'] >= 1){
echo ' [<a href = "forum.php?act=theme&id='.$id.'&del='.$msg['id'].'"><font color="red"><b>x</b></font> Удал</a>]';
if(ban($user['id'])){
if($msg['user'] != $u['id'])echo ' [<a href = "adminka.php?act=delban_users&id='.$user['id'].'"><font color="red">Разбанить</font></a>]';
} else {
if($msg['user'] != $u['id'])echo ' [<a href = "adminka.php?act=ban_users&id='.$user['id'].'"><font color="red">Бан</font></a>]';
}
}
echo '</small>';
echo '</div>';
@$i++;
}
if ($all >= 11)echo '<div class="title">';
if ($page != $total) {
echo '<a name="page-down" style="float: right; text-decoration: none;" href="#page-up"><img src = "ico/page_up.png"></a>';
}
if($sort == 'message') {
$sortq = 'ASC';
if ($all >= 11)echo '<a href = "forum.php?act=theme&id='.$id.'&sort=time&page='.$page.'">Новые</a> | <b>Поcледние</b>';
}
if($sort == 'time' || empty($sortq)) {
$sort = 'time';
$sortq = 'DESC';
if ($all >= 11)echo '<b>Новые</b> | <a href = "forum.php?act=theme&id='.$id.'&sort=message&page='.$page.'">Поcледние</a>';
}
if ($all >= 11)echo '</div>';
echo '</div>';
navigation($page, $total,'forum.php?act=theme&id='.$id.'&sort='.$sort.'&');
}else{
error(' Сообщений еще нет. Будь первым !');
}
echo '</div>';
require('foot.php');
} else {
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>ошибка</b></div>';
error(' Такой темы нет !');
require('foot.php');
}
break;
//~~~~~~~Просмотр форума~~~~~~~//
case 'forum':
if(isset($_GET['id'])){
$id=num($_GET['id']);
$req = mysql_query("SELECT * FROM `forum_forums` WHERE `id` = '$id' LIMIT 1");
if (mysql_num_rows($req)) {
$forum = mysql_fetch_assoc($req);
}
}
if ($forum){
$cat = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_categories` WHERE `id` = '".$forum['cat']."' LIMIT 1"));
$name_cat = checkout($cat['name']);
$name_forum = checkout($forum['name']);
$title = $title.' | Форум';
require('head.php');
echo '<div class="title">';
echo '<img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <a href = "forum.php?act=cat&id='.$cat['id'].'">'.$name_cat.'</a> <a href = "forum.php?act=forum&id='.$forum['id'].'">'.$name_forum.'</a>';
echo '</div>';
if($u){
echo '<div class="nav">';
echo '<img src="ico/ico.gif" alt="!"/> <a href = "forum.php?act=add_theme&id='.$forum['id'].'"><b>Создать тему</b></a>';
echo '</div>';
} else {
echo '<div class="nav"> Чтобы создать темы в форуме нужно пройти регистрацию !</div>';
}
$all = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_themes` WHERE `forum` = '".$forum['id']."'"), 0);
if($all > 0){
$total = intval(($all - 1) / 10) + 1;
$page = num(@$_GET['page']);
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * 10 - 10;
if ($all >= 11)echo '<div class="title">';
if ($page != $total) {
echo '<a name="page-up" style="float: right; text-decoration: none;" href="#page-down"><img src = "ico/page_down.png"></a>';
}
$sort = check(@$_GET['sort']);
if($sort == 'ord') {
$sortq = 'time';
if ($all >= 11)echo '<a href = "forum.php?act=forum&id='.$forum['id'].'&sort=fix&page='.$page.'">Поcледние</a> | <b>Новые</b>';
}
if($sort == 'fix' || empty($sortq)) {
$sort = 'fix';
$sortq = 'fix';
if ($all >= 11)echo '<b>Поcледние</b> | <a href = "forum.php?act=forum&id='.$forum['id'].'&sort=ord&page='.$page.'">Новые</a>';
}
if ($all >= 11)echo '</div>';
$result = mysql_query("SELECT * FROM `forum_themes` WHERE `forum` = '".$forum['id']."' ORDER BY $sortq DESC LIMIT $start, 10");
while($theme = mysql_fetch_assoc($result)){
echo @$i % 2 ? '<div class="div">' : '<div class="div">';
$end = mysql_query("SELECT `user`,`time` FROM `forum_themes` WHERE `id` = '".$theme['id']."' ORDER BY `fix` DESC");
$end_msg = mysql_fetch_array($end);
$count = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_messages` WHERE `theme` = '".$theme['id']."'"), 0);
$all_page = intval(($count - 1) / 10) + 1;
$name = checkout($theme['name']);
$who = checkout(@$theme['login']);
if($theme['fix'] == 1) { echo '<img src="ico/stick.gif" alt=""/> ';
} else {
echo '<img src="ico/topics.gif" alt="image" /> ';
}
echo '<a href = "forum.php?act=theme&id='.$theme['id'].'&cat=1">'.$name.'</a> ('.$count.')</a>';
if($theme['close'] == 1)echo ' <img src="ico/lock.gif" alt="image" />';
echo '<a href = "forum.php?act=theme&id='.$theme['id'].'&cat=1&page='.$all_page.'"> → </a></br>';
echo '<small>';
echo '<a href = "/page.php?id='.$theme['user'].'">'.login($theme['user']).'</a> / '.vremya($end_msg['time']).' ';
if($theme['18'] == 1) { echo '/ <font color="red">18+</font>'; }
echo '</small>';
if ($u['admin'] == 1 || $u['admin'] == 2 || $u['admin'] == 3) {
echo '<br><small><a href = "forum.php?act=edit_theme&id='.$theme['id'].'">Изменить</a> - <a href = "forum.php?act=delete_theme&id='.$theme['id'].'">Удалить</a></small>';
}
echo '</div>';
@$i++;
}
if ($all >= 11)echo '<div class="title">';
if ($page != $total) {
echo '<a name="page-down" style="float: right; text-decoration: none;" href="#page-up"><img src = "ico/page_up.png"></a>';
}
if($sort == 'ord') {
$sortq = 'DESC';
if ($all >= 11)echo '<a href = "forum.php?act=forum&id='.$forum['id'].'&sort=fix&page='.$page.'">Поcледние</a> | <b>Новые</b>';
}
if($sort == 'fix' || empty($sortq)) {
$sort = 'fix';
$sortq = 'ASC';
if ($all >= 11)echo '<b>Поcледние</b> | <a href = "forum.php?act=forum&id='.$forum['id'].'&sort=ord&page='.$page.'">Новые</a>';
}
if ($all >= 11)echo '</div>';
echo '</div>';
if($u){
if ($page != $total) {
echo '<div class="nav">';
echo '<img src="ico/ico.gif" alt="!"/> <a href = "forum.php?act=add_theme&id='.$forum['id'].'"><b>Создать тему</b></a>';
echo '</div>';
}
}
navigation($page, $total,'forum.php?act=forum&id='.$forum['id'].'&sort='.$sort.'&');
} else {
error(' Тем пока нет !');
}
require('foot.php');
} else {
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>ошибка</b></div>';
error(' Такого форума нет !');
require('foot.php');
}
break;
//~~~~~~~~~~~~~Просмотр категории~~~~~~~~~~//
case 'cat':
if(isset($_GET['id'])){
$id=num($_GET['id']);
$req = mysql_query("SELECT * FROM `forum_categories` WHERE `id` = '$id' LIMIT 1");
if (mysql_num_rows($req)) {
$category = mysql_fetch_assoc($req);
}
}
if ($category){
$name = $category['name'];
$title = $title.' | Форум';
require('head.php');
$cat = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_categories` WHERE `id`"));
echo '<div class="title">';
echo '<img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <a href = "forum.php?act=cat&id='.$category['id'].'">'.$name.'';
echo '</div>';
if ($u['admin'] == 1 || $u['admin'] == 2 || $u['admin'] == 3) {
echo '<div class="nav"><img src="ico/dirnew.png" alt="!"/> <a href = "forum.php?act=add_forum&id='.$category['id'].'">Добавить форум</a> / <a href = "forum.php?act=cat&id='.$category['id'].'&info=1">Информация</a></div>';
}
$all = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_forums` WHERE `cat` = '".$category['id']."'"), 0);
if($all > 0){
$total = intval(($all - 1) / 15) + 1;
$page = num(@$_GET['page']);
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * 15 - 15;
$result = mysql_query("SELECT * FROM `forum_forums` WHERE `cat` = '".$category['id']."' ORDER BY `ord` DESC LIMIT $start, 15");
while($forum = mysql_fetch_assoc($result)){
echo @$i % 2 ? '<div class="div">' : '<div class="div">';
$count = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_themes` WHERE `forum` = '".$forum['id']."'"), 0);
$count2 = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_messages` WHERE `forum` = '".$forum['id']."'"), 0);
$name = checkout($forum['name']);
echo '<img src="ico/forums.gif" alt="image" /> <a href = "forum.php?act=forum&id='.$forum['id'].'">'.$name.'</a> ('.$count.' | '.$count2.') ';
if ($u['admin'] == 1 || $u['admin'] == 2 || $u['admin'] == 3) { echo '<br><small><a href = "forum.php?act=edit_forum&id='.$forum['id'].'">Изменить</a> - <a href = "forum.php?act=delete_forum&id='.$forum['id'].'">Удалить</a></small>'; }
echo '</div>';
if ($u['admin'] == 1 || $u['admin'] == 2 || $u['admin'] == 3 || $u['admin'] == 4 || $u['admin'] == 5){
if(@$_GET['info']) {
if($u['sex'] == 'm'){
$action[0] = 'Создал';
} else {
$action[0] = 'Создала';
}
if($u['sex'] == 'm'){
$who[0] = 'Редактировал';
} else {
$who[0] = 'Редактировала';
}
echo '<div class="zona">';
echo '<small>'.$action[0].': <a href = "/page.php?id='.$forum['user'].'">'.login($forum['user']).'</a>
<b>/</b> '.$who[0].': <a href = "/page.php?id='.$forum['edit'].'">'.login($forum['edit']).'</a> ['.vremya($forum['etime']).'] </small>';
echo '</div>';
}
}
@$i++;
}
echo '</div>';
navigation($page, $total,'forum.php?act=cat&id='.$category['id'].'&');
}else{
error(' Форумов не найдено !');
}
require('foot.php');
} else {
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>ошибка</b></div>';
error(' Такого форума не существует !');
require('foot.php');
}
break;
//~~~~~~~~~~Новые~~~~~~~~~//
case 'new':
$title = $title.' | Форум';
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>Новые темы</b></div>';
$all = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_themes` WHERE `ord` > '".(time()-(60*60*24))."'"), 0);
if($all > 0){
$total = num(($all - 1) / 10) + 1;
$page = num($_GET['page']);
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * 10 - 10;
$result = mysql_query("SELECT * FROM `forum_themes` WHERE `ord` > '".(time()-(60*60*24))."' ORDER BY `ord` DESC LIMIT $start, 10");
while($theme = mysql_fetch_assoc($result)){
echo $i % 2 ? '<div class="div">' : '<div class="div">';
$count = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_messages` WHERE `theme` = '".$theme['id']."'"), 0);
$name = checkout($theme['name']);
$end = mysql_query("SELECT `user`,`time` FROM `forum_themes` WHERE `id` = '".$theme['id']."' ORDER BY `time` DESC");
$end_msg = mysql_fetch_array($end);
if($theme['fix'] == 1) { echo '<img src="ico/stick.gif" alt=""/> ';
} else {
echo '<img src="ico/topics.gif" alt="image" /> ';
}
echo '<a href = "forum.php?act=theme&id='.$theme['id'].'&cat=1">'.$name.'</a> ('.$count.') <small>'.vremya($end_msg['time']).'</small> </a>';
if($theme['18'] == 1) { echo '/ <font color="red">18+</font>'; }
if($theme['close'] == 1) {echo '<img src="ico/lock.gif" alt="image" />'; }
echo '</div>';
$i++;
}
echo '</div>';
navigation($page, $total,'forum.php?act=new&');
} else {
error(' Новых тем пока нет !');
}
echo '</div>';
require('foot.php');
break;
//~~~~~~~~~~Новые сообщения~~~~~~~~~//
case 'messagnew':
$title = $title.' | Форум';
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>Новые сообщения</b></div>';
$all = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `ord` > '".(time()-(60*60*24))."'"), 0);
if($all > 0){
$total = num(($all - 1) / 10) + 1;
$page = num($_GET['page']);
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * 10 - 10;
$result = mysql_query("SELECT * FROM `forum_messages` WHERE `ord` > '".(time()-(60*60*24))."' ORDER BY `ord` DESC LIMIT $start, 10");
while($theme = mysql_fetch_assoc($result)){
echo $i % 2 ? '<div class="div">' : '<div class="div">';
$count = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_messages` WHERE `theme` = '".$theme['id']."'"), 0);
$name = checkout($theme['name']);
$end = mysql_query("SELECT `user`,`time` FROM `forum_messages` WHERE `id` = '".$theme['id']."' ORDER BY `time` DESC");
$end_msg = mysql_fetch_array($end);
if($theme['fix'] == 1) { echo '<img src="ico/stick.gif" alt=""/> ';
} else {
echo '<img src="ico/topics.gif" alt="image" /> ';
}
echo '<a href = "forum.php?act=theme&id='.$theme['id'].'&cat=1">'.$name.'</a> ('.$count.') <small>'.vremya($end_msg['time']).'</small> </a>';
if($theme['18'] == 1) { echo '/ <font color="red">18+</font>'; }
if($theme['close'] == 1) {echo '<img src="ico/lock.gif" alt="image" />'; }
echo '</div>';
$i++;
}
echo '</div>';
navigation($page, $total,'forum.php?act=new&');
} else {
error(' Новых сообщений пока нет !');
}
echo '</div>';
require('foot.php');
break;
//~~~~~~~~~~~~~~~~Поиск~~~~~~~~~~~~~~~~//
case 'search':
$title = $title . ' :: Поиск';
require('head.php');
echo '<div class="title"><center><a href = "forum.php">Форум</a> :: <b>Поиск</b></center></div>';
if (isset($_POST['ok'])) {
$s = check($_POST['s']);
if (empty($s)) {
header('Location: forum.php?act=search');
} else {
$all = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_themes` WHERE `name` LIKE '%$s%'"), 0);
if ($all > 0) {
@$total = intval(($all - 1) / $count) + 1;
@$page = num($_GET['page']);
if (empty($page) or $page < 0)
$page = 1;
if ($page > $total)
$page = $total;
@$start = $page * $count - $count;
echo '<div class="title"><center>По запросу: <b>' . $s . '</b> найдено <font color="green">' . $all . '</font> тем </center></div>';
$result = mysql_query("SELECT * FROM `forum_themes` WHERE `name` LIKE '%$s%' ORDER BY `id` LIMIT $start, 10");
while ($theme = mysql_fetch_assoc($result)) {
echo '<div class="div">';
$end = mysql_query("SELECT `user`,`time` FROM `forum_themes` WHERE `id` = '" . $theme['id'] . "' ORDER BY `fix` DESC");
$end_msg = mysql_fetch_array($end);
$count = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_messages` WHERE `theme` = '" . $theme['id'] . "'"), 0);
$all_page = intval(($count - 1) / 10) + 1;
$name = $theme['name'];
$who = @$theme['login'];
if ($theme['fix'] == 1) {
echo '<img src="style/page/stick.gif" alt=""/> ';
}
if ($theme['close'] == 1) {
echo '<span style="float:right;"><img src="style/page/lock.gif" alt="image" /></span>';
}
echo '<a href = "forum.php?act=theme&id=' . $theme['id'] . '&cat=1">' . $name . '</a> (' . $count . ')</a><br />';
echo '<small>';
echo 'Автор: <a href = "page.php?id=' . $theme['user'] . '"><b><font color="#79358c">' . login($theme['user']) . '</font></b></a> / <font color="grey">' . vremya($end_msg['time']) . '</font>';
if ($theme['18'] == 1) {
echo '/ <font color="red">18+</font>';
}
echo '</small>';
echo '</div>';
}
navigation($page, $total, 'forum.php?act=search&');
} else {
error(' По запросу <b>' . $s . '</b> ничего не найдено!');
}
}
} else {
error('Вы ничего не ввели!');
}
require('foot.php');
break;
//~~~~~~~~~~~~~Список категорий~~~~~~~~~~~~~~//
default:
$title = $title.' | Форум';
require('head.php');
echo '<div class="title"><img src="ico/forum.png" alt="!"/> <a href = "forum.php">Форум</a> <b>Категории:</b></div>';
if ($u['admin'] == 1 || $u['admin'] == 2 || $u['admin'] == 3) {
echo '<div class="div"><img src="ico/dirnew.png" alt="!"/> <a href = "forum.php?act=add_cat">Добавить категорию</a> / <a href = "?&info=1">Информация</a></div>';}
$new = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_themes` WHERE `time` > '".(time()-(60*60*24))."'"), 0);
$messagnew = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_messages` WHERE `time` > '".(time()-(60*60*24))."'"), 0);
$rating = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `stat_forum_messages` > 0"), 0);
echo '<div class="div">
<img src="/about/img/str.png" alt="!"/><a href = "forum.php?act=new"> Новые темы</a> ('.$new.')
</a> <br /> <img src="/about/img/str.png" alt="!"/><a href = "/user/sforum.php"> Поиск</a></div>';
#(+<font '.$messagnew.')
$all = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_categories`"), 0);
if($all > 0){
$result = mysql_query("SELECT * FROM `forum_categories` ORDER BY `ord` DESC");
while($cat = mysql_fetch_assoc($result)){
echo @$i % 2 ? '<div class="div">' : '<div class="div">';
$opis = checkout($cat['opis']);
$name = checkout($cat['name']);
$count = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_themes` WHERE `cat` = '".$cat['id']."'"), 0);
$count2 = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_messages` WHERE `cat` = '".$cat['id']."'"), 0);
echo '<img src="/ico/forum.png" alt="image" /> <a href = "forum.php?act=cat&id='.$cat['id'].'">'.$name.'</a> <font color = "#777777">('.$count.' | '.$count2.')</font>';
echo '</br><small>'.$opis.'</small>';
if ($u['admin'] == 1 || $u['admin'] == 2 || $u['admin'] == 3) {
echo '<br><small><a href = "forum.php?act=edit_cat&id='.$cat['id'].'">Изменить</a>
- <a href = "forum.php?act=delete_cat&id='.$cat['id'].'">Удалить</a></small><br/>'; }
echo '</div>';
if ($u['admin'] >= 1){
if(@$_GET['info']) {
if($u['sex'] == 'm'){
$action[0] = 'Создал';
} else {
$action[0] = 'Создала';
}
if($u['sex'] == 'm'){
$who[0] = 'Редактировал';
} else {
$who[0] = 'Редактировала';
}
echo '<div class="zona">';
echo '<small>'.$action[0].': <a href = "/page.php?id='.$cat['user'].'">'.login($cat['user']).'</a>
<b>/</b> '.$who[0].': <a href = "/page.php?id='.$cat['edit'].'">'.login($cat['edit']).'</a> ['.vremya($cat['etime']).'] </small>';
echo '</div>';
}
}
@$i++;
}
}else{
error(' Категорий пока нет !');
}
echo '</div>';
require('foot.php');
break;
}
?>