View file comm/razd.php

File size: 4.3Kb
<?php
###########################################
###       Сообщества для соц. сети      ###
###       Автор: Неизвестен             ###
###    Доделка и переделка: WapStyle    ###
###          НЕ ДЛЯ ПРОДАЖИ             ###
### НЕ ДЛЯ БЕСПЛАТНОГО РАСПРОСТРАНЕНИЯ  ###
###########################################

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();

echo '<div class="menu">';

$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']<100){
	echo '<div class="err">Для создания сообщества Вам нужно набрать как минимум <b>100</b> баллов.</div>';
	}

if(isset($user) && $user['level']==10){
	include 'inc/del_comm.php';
	}

$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 '<form action="razd.php?id_razd='.$id_razd.'&amp;page='.$page.'" method="post">';
echo '<div class="str"><b>Сорт</b>:&nbsp;<select name="sort"><option value="name">имя</option><option value="time_create">дата создания</option><option value="status">статус</option><option value="new">новые</option></select>';
echo '<input type="submit" value="ok"></div></form>';

echo '<table class="post">';

if($k_post==0){
	echo '<tr><td class="p_t">Нет сообществ</td></tr>';
	}

$asc='DESC';
$order='id';

if(isset($_POST['sort']) && $_POST['sort']=='name'){
	$order='name';
	}else if(isset($_POST['sort']) && $_POST['sort']=='time_create'){
		$order='time_create';
		}else if(isset($_POST['sort']) && $_POST['sort']=='status'){
			$order='status';
			}else if(isset($_POST['sort']) && $_POST['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="'.H.'sys/comm/'.$post['id'].'.jpg" align="left" width="40" height="45" alt=""/>';
	}else{
		echo 'no logo';
		}

echo '</td>';

echo '<td class="p_m"><a href="comm.php?id='.$post['id'].'">'.esc(trim(smiles(stripcslashes(htmlspecialchars($post['name']))))).'</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/>&#187;&nbsp;<a href="razd.php?id_razd='.$id_razd.'&amp;id='.$post['id'].'&amp;act=delete">Удалить</a>';
	}

echo '</td></tr>';
}

echo '</table>';

if($k_page>1){
	str('razd.php?id_razd='.$razd['id'].'&amp;',$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)==0){
	echo '&#187;&nbsp;<b><a href="create_comm.php?id_razd='.$razd['id'].'">Создать сообщество</a></b><br/>';
	}
	}

echo '&#187;&nbsp;<a href="index.php">К разделам</a></div>';
include_once '../sys/inc/tfoot.php';
?>