<?
err();
echo "<div class='totallink'>\n";
echo "<img src='/forum/img/pls.png' alt='' /> <a href=\"/forum/$forum[id]/$razdel[id]/?act=new\" title='Создать новую тему'><font color='#a19f9b'><u>Создать тему</u></font></a>\n";
echo "</div>\n";
echo "<div class='textmes'>\n";
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_t` WHERE `id_forum` = '$forum[id]' AND `id_razdel` = '$razdel[id]'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `forum_t` WHERE `id_forum` = '$forum[id]' AND `id_razdel` = '$razdel[id]' ORDER BY `up` DESC,`time` DESC  LIMIT $start, $set[p_str]");
if (mysql_num_rows($q)==0) {

echo "  <div class='komm'>\n";
echo "Нет тем в разделе \"$razdel[name]\"\n";
echo "  </div>\n";

}

while ($them = mysql_fetch_assoc($q))
{
echo "<img src='/style/themes/$set[set_them]/forum/14/them_$them[up]$them[close].png' alt='' />";
echo " <a href='/forum/$forum[id]/$razdel[id]/$them[id]/'><font color='black'>$them[name]</font></a> <font color='#71706e'>[".mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_p` WHERE `id_forum` = '$forum[id]' AND `id_razdel` = '$razdel[id]' AND `id_them` = '$them[id]'"),0)."]</font> \n";
$post2=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_p` WHERE `id_them` = '$them[id]' AND `id_razdel` = '$razdel[id]' AND `id_forum` = '$forum[id]' ORDER BY `time` DESC LIMIT 1"));
$ank2=get_user($post2['id_user']);
echo "<font color='#71706e'>$ank2[nick]</font> <a href='/forum/$forum[id]/$razdel[id]/$them[id]/?page=end'><font color='black'><b>&raquo</b></font></a><br/>\n";

}
echo "</div>\n";

if ($k_page>1)str("/forum/$forum[id]/$razdel[id]/?",$k_page,$page); // Вывод страниц

?>