Файл: test.masteram.us/comm/razd.php
Строк: 61
<?php
include '../Core.php';
if(isset($_GET['id_razd'])){
$id_razd = intval($_GET['id_razd']);
}else{
header("Location: index.php");
}
$set['title']='Список сообществ';
include_once '../sys/inc/thead.php';
title();
$razd = mysql_fetch_array(mysql_query('SELECT * FROM `community_razd` WHERE `id` = '.$id_razd.' LIMIT 1'));
if($id_razd==0 || $id_razd<0){
echo '<div class="err">Иди нахуй! Хакер недоношеный!</div>';
}else if($id_razd!=$razd['id']){
echo '<div class="err">Раздел не найден.</div>';
}else{
if(isset($user) && $user['balls']<1000){
echo '<div class="err">Для создания сообщества Вам нужно набрать как минимум <b>1000</b> монет.</div>';
}
if(isset($user) && $user['level']==10){
if(isset($_GET['act']) && $_GET['act']=='delete'){
$id = $_GET['id'];
mysql_query("DELETE FROM `community_board` WHERE `id_comm` = '$id'"); //мини чат
mysql_query("DELETE FROM `community_comm` WHERE `id` = '$id'"); //сообщества
mysql_query("DELETE FROM `community_user_incomm` WHERE `cid` = '$id'"); //пользователи
mysql_query("DELETE FROM `comm_ban` WHERE `id_comm` = '$id'"); //баны
mysql_query("DELETE FROM `comm_forum_f` WHERE `id_comm` = '$id'"); //форум
mysql_query("DELETE FROM `comm_forum_p` WHERE `id_comm` = '$id'");
mysql_query("DELETE FROM `comm_forum_r` WHERE `id_comm` = '$id'");
mysql_query("DELETE FROM `comm_forum_t` WHERE `id_comm` = '$id'");
mysql_query("DELETE FROM `comm_forum_zakl` WHERE `id_comm` = '$id'");
mysql_query("DELETE FROM `comm_forum_files_rating` WHERE `id_comm` = '$id'");
mysql_query("DELETE FROM `comm_obmen_dir` WHERE `id_comm` = '$id'");
mysql_query("DELETE FROM `comm_obmen_files` WHERE `id_comm` = '$id'");
mysql_query("DELETE FROM `comm_obmen_komm` WHERE `id_comm` = '$id'");
mysql_query("DELETE FROM `comm_wall` WHERE `id_comm` = '$id'");
mysql_query("OPTIMIZE TABLE `community_board` , `community_comm` , `community_user_incomm` , `comm_ban` , `comm_forum_f` , `comm_forum_files` , `comm_forum_files_rating` , `comm_forum_p` , `comm_forum_r` , `comm_forum_t` , `comm_forum_zakl`");
msg("Сообщество успешно удалено ");
}
}
$razd = mysql_fetch_array(mysql_query("SELECT * FROM `community_razd` WHERE `id` = '".$id_razd."'"));
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `community_comm` WHERE `id_razd` = '$razd[id]'"),0);
$k_page = k_page($k_post,$set['p_str']);
$page = page($k_page);
$start = $set['p_str']*$page-$set['p_str'];
echo "<div class='rekl_main'>n";
echo "сорт: ";
echo "<a href='razd.php?id_razd=".$id_razd."&page=".$page."&sort=name'>имя</a> |n";
echo "<a href='razd.php?id_razd=".$id_razd."&page=".$page."&sort=time_create'>дата</a> |n";
echo "<a href='razd.php?id_razd=".$id_razd."&page=".$page."&sort=status'>статус</a> |n";
echo "<a href='razd.php?id_razd=".$id_razd."&page=".$page."&sort=new'>новые</a> n";
echo "</div>n";
echo '<table class="post">';
if($k_post==0){
echo '<tr><td class="p_t">Нет сообществ</td></tr>';
}
$asc='DESC';
$order='id';
if(isset($_GET['sort']) && $_GET['sort']=='name'){
$order='`name`';
}else if(isset($_GET['sort']) && $_GET['sort']=='time_create'){
$order='`time_create`';
}else if(isset($_GET['sort']) && $_GET['sort']=='status'){
$order='`status`';
}else if(isset($_GET['sort']) && $_GET['sort']=='new'){
$order='`id`';
$asc='DESC';
}
$q = mysql_query("SELECT * FROM `community_comm` WHERE `id_razd` = '$razd[id]' ORDER BY $order $asc LIMIT $start, $set[p_str]");
while($post = mysql_fetch_array($q)){
echo '<tr><td class="icon14">';
if(is_file(H.'sys/comm/'.$post['id'].'.jpg')){
echo '<img src="../../../sys/comm/'.$post['id'].'.jpg" align="left" width="40" height="45" alt=""/>';
}else{
echo "<img src='/comm/logo.png' alt='' class='icon'/>n";
}
echo '</td>';
echo '<td class="anput"><a href="comm.php?id='.$post['id'].'"><b>'.esc(trim(smiles(stripcslashes(htmlspecialchars($post['name']))))).'</b></a> ('.mysql_num_rows(mysql_query("SELECT `id` FROM `community_user_incomm` WHERE `cid` = '$post[id]'")).') ';
if($post['status']==1){
echo '<img src="1.gif" alt="" class="icon"/><br/>';
}else{
echo '<img src="2.gif" alt="" class="icon"/><br/>';
}
echo output_text($post['about']);
if(isset($user) && $user['level']>3){
echo '<br/><a href="razd.php?id_razd='.$id_razd.'&id='.$post['id'].'&act=delete">Удалить</a>';
}
echo '</td></tr>';
}
echo '</table>';
if($k_page>1){
str('razd.php?id_razd='.$razd['id'].'&',$k_page,$page);
}
if($user['balls']>1000 && mysql_result(mysql_query("SELECT COUNT(id) FROM `community_comm` where `id_author` = '$user[id]' LIMIT 1"),0)<51){
echo "<img src='/style/top.gif' alt='' class='icon'/>n";
echo '<b><a href="create_comm.php?id_razd='.$razd['id'].'">Создать сообщество</a></b><br/>';
}
}
echo "<div class='p_t'>";
echo "<img src='/style/back.gif' alt='' class='icon'/>n";
echo '<a href="index.php">Сообщества</a></div>';
echo "</div>n";
include_once '../sys/inc/tfoot.php';
?>