Файл: vkollektive2014/soo/inc/razdel.php
Строк: 24
<?
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_forum_thems` WHERE `id_forum` = '".$forum['id']."' AND `id_soo` = '".$soo['id']."'"),0);
$total = intval(($k_post - 1) / 10) + 1;
$page = intval(@$_GET['page']);
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * 10 - 10;
$q=mysql_query("SELECT * FROM `soo_forum_thems` WHERE `id_forum` = '".$forum['id']."' AND `id_soo` = '".$soo['id']."' ORDER BY `up`");
if (mysql_num_rows($q)==0) {
echo "Нет тем в форуме "".$forum['name'].""<br />n";
}
while ($them = mysql_fetch_assoc($q))
{
if(@$num==1){
echo "<div class='nav'>";
$num=0;
}else{
echo "<div class='div'>";
$num=1;}
if($them['up']==1)echo "<img src='img/forum/them_2.png' alt='' class='icon'/>";
if($them['close']==1)echo "<img src='img/forum/them_1.png' alt='' class='icon'/>";
if($them['up']==0 && $them['close']==0)echo "<img src='img/forum/them_0.png' alt='' class='icon'/>";
echo " <a href='?s=$soo[id]&id_forum=$forum[id]&id_them=$them[id]'>".$them['name']."</a> <a href='?s=$soo[id]&id_forum=$forum[id]&id_them=$them[id]&page=end'>(".mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_forum_mess` WHERE `id_forum` = '$forum[id]' AND `id_soo` = '$soo[id]' AND `id_them` = '$them[id]'"),0).")</a> (".vremya($them['time_create']).") <br />n";
$ank = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '$them[id_user]' LIMIT 1"));
$post=mysql_fetch_assoc(mysql_query("SELECT * FROM `soo_forum_mess` WHERE `id_them` = '$them[id]' AND `id_soo` = '$soo[id]' AND `id_forum` = '$forum[id]' ORDER BY `time`"));
if ($post!=NULL){
$ank2 = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '$post[id_user]' LIMIT 1"));
echo" Последний комм. был написан: (".vremya($post2['time']).")<br />n";
}
echo "</div>";
}
if($page>1)navigation($page, $total,'?s='.$soo['id'].'&id_forum='.$forum['id'].'&'); // Вывод страниц
?>