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

File size: 2.34Kb
<?
require_once '../../core/system.php';
echo only_reg();
echo ban();
if (isset($_GET['id']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_razdel` WHERE `id` = '".intval($_GET['id'])."'"),0) == true){
$razdel = mysql_fetch_array(mysql_query("SELECT * FROM `forum_razdel` WHERE `id`  = '".intval($_GET['id'])."'"));
}else{
$_SESSION['err'] = "Раздел не найден";
header('Location: /forum/');
exit();
}
$header = $razdel['name'];
require_once '../../core/head.php';
$k_post = mysql_result(mysql_query("SELECT COUNT(id) FROM `forum_topic` WHERE `id_razdel` = '".$razdel['id']."'"),0);
$k_page = k_page($k_post,10);
$page = page($k_page);
$start = 10*$page-10;
$q = mysql_query("SELECT * FROM `forum_topic` WHERE `id_razdel` = '".$razdel['id']."' ORDER BY verh DESC, 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='down-foot but-list'>";
while($post = mysql_fetch_array($q)){
if($post['verh']==1){
$koll = mysql_query("SELECT * FROM `forum_comm` 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 style='font-weight:bold;' href='/forum/post/topic/".$post['id']."/?page=end'><img src='/images/icon/section_new.png'> $post[name] <span class='float-right'>$kol</span></a>";
}else{$koll = mysql_query("SELECT * FROM `forum_comm` 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='/forum/post/topic/".$post['id']."/?page=end'><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>";
}
}
}
echo "</div>";
if ($k_page > 1){
echo "<hr>";
str('?',$k_page,$page); 
}
echo "<div class='but-list-dark'>";
if($razdel['id']!=3 or $user['prava'] > 4){
echo "<hr><a href='/forum/new_topic?id=".$razdel['id']."'><img src='/images/icon/сreate.png'> Создать новый топик</a>";
} else {
echo "<hr>";
}
echo "<a href='/forum/'><img src='/images/icon/section.png'> Вернуться к разделам</a></div>";
require_once '../../core/foot.php';
?>