Файл: comm/razd.php
Строк: 71
<?php
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.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();
aut();
$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']<50){
echo '<div class="err">Для создания сообщества Вам нужно набрать как минимум <b>100</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 '<table class="post">';
if($k_post==0){
echo '<div class="frends">Нет сообществ</div>';
}
$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">';
echo '<img src="/comm/g14.png" alt="" />';
echo '</td>';
echo '<td class="p_m"><a href="comm.php?id='.$post['id'].'">'.esc(trim(smiles(stripcslashes(htmlspecialchars($post['name']))))).'</a><br />';
echo 'Участников: '.mysql_num_rows(mysql_query("SELECT `id` FROM `community_user_incomm` WHERE `cid` = '$post[id]'")).'<br />';
echo output_text($post['about']);
if(isset($user) && $user['level']>4){
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']>100 && mysql_result(mysql_query("SELECT COUNT(id) FROM `community_comm` where `id_author` = '$user[id]' LIMIT 1"),0)<51){
echo ':: <a href="create_comm.php?id_razd='.$razd['id'].'">Создать сообщество</a><br/>';
}
}
include_once '../sys/inc/tfoot.php';
?>