Файл: test.masteram.us/comm/forum/inc/forum.php
Строк: 27
<?php
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `comm_forum_r` WHERE `id_forum` = '$forum[id]' AND `id_comm` = '$id_comm'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
echo '<table class="post">';
$q=mysql_query("SELECT * FROM `comm_forum_r` WHERE `id_forum` = '$forum[id]' AND `id_comm` = '$id_comm' ORDER BY `time` DESC LIMIT $start, $set[p_str]");
if(mysql_num_rows($q)==0){
echo '<tr><td class="p_t">Нет разделов</td></tr>';
}
while($razdel = mysql_fetch_array($q)){
echo '<tr>';
if($num==1){
echo " <td class='rer'>n";
$num=0;
}else{
echo " <td class='aut'>n";
$num=1;}
//echo '<td class="icon14"><img src="/style/themes/'.$set['set_them'].'/forum/razdel.png" alt=""/></td><td class="p_t">';
echo '<a href="index.php?id_forum='.$forum['id'].'&id_razdel='.$razdel['id'].'&id_comm='.$id_comm.'"><b>'.$razdel['name'].'</b></a> ('.mysql_result(mysql_query("SELECT COUNT(*) FROM `comm_forum_p` WHERE `id_forum` = '$forum[id]' AND `id_razdel` = '$razdel[id]' AND `id_comm` = '$id_comm'"),0).'/'.mysql_result(mysql_query("SELECT COUNT(*) FROM `comm_forum_t` WHERE `id_forum` = '$forum[id]' AND `id_razdel` = '$razdel[id]' AND `id_comm` = '$id_comm'"),0).')<br/>';
$them=mysql_fetch_array(mysql_query("SELECT * FROM `comm_forum_t` WHERE `id_razdel` = '$razdel[id]' AND `id_forum` = '$forum[id]' AND `id_comm` = '$id_comm' ORDER BY `time` DESC LIMIT 1"));
if($them!=NULL){
$post1=mysql_fetch_array(mysql_query("SELECT * FROM `comm_forum_p` WHERE `id_them` = '$them[id]' AND `id_razdel` = '$razdel[id]' AND `id_forum` = '$forum[id]' AND `id_comm` = '$id_comm' ORDER BY `time` ASC LIMIT 1"));
$ank=get_user($post1['id_user']);
$post2=mysql_fetch_array(mysql_query("SELECT * FROM `comm_forum_p` WHERE `id_them` = '$them[id]' AND `id_razdel` = '$razdel[id]' AND `id_forum` = '$forum[id]' AND `id_comm` = '$id_comm' ORDER BY `id` DESC LIMIT 1"));
$ank2=get_user($post2['id_user']);
echo $them['name'].' ('.mysql_result(mysql_query("SELECT COUNT(*) FROM `comm_forum_p` WHERE `id_forum` = '$forum[id]' AND `id_razdel` = '$razdel[id]' AND `id_them` = '$them[id]' AND `id_comm` = '$id_comm'"),0).')<br/>';
echo '<span style="color:'.$ank['ncolor'].'">'.$ank['nick'].'</span>/<span style="color:'.$ank2['ncolor'].'">'.$ank2['nick'].'</span> ('.vremja($post2['time']).')<br/>';
}else{
echo 'Темы не создавались :(<br/>';
}
//echo '</td></tr>';
}
echo '</table>';
if($k_page>1){
str("index.php?id_forum=$forum[id]&id_comm=$id_comm&",$k_page,$page);
}
?>