View file sdark.mobi/clan_forum/post/index.php

File size: 3.59Kb
<?
require_once '../../core/system.php';
echo only_reg();
echo ban();
if (isset($_GET['id']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_razdel_clan` WHERE `id` = '".intval($_GET['id'])."'"),0) == true){
$razdel = mysql_fetch_array(mysql_query("SELECT * FROM `forum_razdel_clan` WHERE `id`  = '".intval($_GET['id'])."'"));
}else{
$_SESSION['err'] = "Раздел не найден";
header('Location: /');
exit();
}
$razd = mysql_fetch_array(mysql_query("SELECT * FROM `forum_razdel_clan` WHERE `id`  = ".intval($_GET['id'])." and `clan`  = ".intval($_GET['clan']).""));
if($razdel['id']!=$razd['id']){
$_SESSION['err'] = "Ошибка"; header("Location: /"); exit();}

$header = $razdel['name'];
require_once '../../core/head.php';
$clan = mysql_fetch_array(mysql_query("SELECT * FROM `clan` WHERE `id`  = '".intval($_GET['clan'])."'"));

$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_topic_clan` WHERE `id_razdel` = '$razdel[id]'  and clan='".intval($_GET['clan'])."'"),0);
$k_page = k_page($k_post,10);
$page = page($k_page);
$start = 10*$page-10;
$q = mysql_query("SELECT * FROM `forum_topic_clan` WHERE `id_razdel` = '$razdel[id]' and clan='".intval($_GET['clan'])."' AND `verh` = '0'  ORDER BY `id` DESC LIMIT $start, 10");
$p = mysql_query("SELECT * FROM `forum_topic_clan` WHERE `id_razdel` = '$razdel[id]' and clan='".intval($_GET['clan'])."' AND `verh` = '1'  ORDER BY `id` DESC LIMIT $start, 10");
if($k_post == 0)echo "<div class='foot grey'><div class='empty'></div>Нет топиков<div class='empty'></div></div>";
echo "<div class='but-list'>";
while($post2 = mysql_fetch_array($p)) {
$koll = mysql_query("SELECT * FROM `forum_comm_clan` WHERE `id_topic` = '$post2[id]'");
$kol = mysql_num_rows($koll);
if($kol==0){$kol='';}else{$kol='<img src="/images/icon/st.png">'.$kol.'';}
echo "<a style='font-weight:bold;' href='/clan_forum/post/topic/$post2[id]/?page=end'&clan=".intval($_GET['clan'])."><img src='/images/icon/section_new.png'> $post2[name] <span class='float-right'>$kol</span></a>";

}
while($post = mysql_fetch_array($q)) {
$koll = mysql_query("SELECT * FROM `forum_comm_clan` WHERE `id_topic` = '$post[id]'");
$kol = mysql_num_rows($koll);
if($kol==0){$kol='';}else{$kol='<img src="/images/icon/st.png">'.$kol.'';}
echo "<a href='/clan_forum/post/topic/$post[id]/?page=end&clan=".intval($_GET['clan'])."'><img src='/images/icon/section_new.png'>";
if($post[close] == 1){
echo "<font color='grey'> $post[name]</font><span class='float-right'>$kol</span></a>";
}else{
echo " $post[name] <span class='float-right'>$kol</span></a></li>";
}} 
if(($razdel['razdel']==2 && $user['clan']!=$clan['id']) && $user['prava']<2){
$_SESSION['err'] = "Раздел закрыт для общего просмотра"; header("Location: /clan_forum/?id=".intval($_GET['clan']).""); exit();}

if($razdel['id']==9 && $user['prava']<2){
$_SESSION['err'] = "Доступ запрещен"; header("Location: /clan_forum/?id=".intval($_GET['clan']).""); exit();}
echo "</div>";
if ($k_page>1){
str('?clan='.intval($_GET['clan']).'&',$k_page,$page); // Вывод страниц
echo "<div class='mini-line'></div>";
}
echo "<div class='but-list-dark'>";
if($clan['id']==$user['clan'] or $user['prava']>4){
echo "<div class='mini-line'></div><a href='/clan_forum/new_topic?id=$razdel[id]&clan=".intval($_GET['clan'])."'><img src='/images/icon/сreate.png'> Создать новый топик</a>";
}else{echo "<div class='mini-line'></div>";}
echo "<a href='/clan_forum?id=".intval($_GET['clan'])."'><img src='/images/icon/section.png'> Вернуться к разделам</a>";
echo "</div>";
require_once '../../core/foot.php';
?>