<?php
$countmess = $db -> dbcount('COUNT(*)','forum_posts');
$countthem = $db -> dbcount('COUNT(*)','forum_tems');
$result = $db -> query("SELECT * FROM `forum_posts`");
while($a = $result -> fetch_assoc()){
if (strftime("%d.%m.%Y",$a['time']) == date("d.m.Y"))
$c++;
}
if($c>0){
$cb= '+'.$c.'';}
$result2 = $db -> query("SELECT * FROM `forum_tems`");
while($a2 = $result2 -> fetch_assoc()){
if (strftime("%d.%m.%Y",$a2['time']) == date("d.m.Y"))
$c2++;
}
if($c2>0){
$ct= '+'.$c2.'';}
$msg .= '('.$countthem.'<span style="color:red">'.$ct.'</span>/'.$countmess.'<span style="color:red">'.$cb.'</span>)';
$sql = $db -> query("SELECT * FROM `forum_tems` ORDER BY `uptime` DESC LIMIT 3");
while ($t = $sql -> fetch_assoc()) {
$col = $db -> dbcount('COUNT(`id`)','golos',"`where`='forum' and `id_w` = '".$t['id']."'");
if($col>0){$st=$diz -> img('golos.png');}else{$st=null;}
if($t['status']==0){$status =''.$diz -> img('r.png').' '.$st.'';}
elseif($t['status']==1){$status=''.$diz -> img('close.png').''.$st.'';}

$posts = $db -> dbcount('COUNT(*)','forum_posts','`tema` = '.$t['id'].'');
$num = isset($ya['num']) ? $ya['num'] : 10;
$tot = intval(($posts - 1) / $num) + 1;
$msg .= '</div><div class="post">'.$status.' <a href="forum/tema'.$t['id'].'">'.$t['name'].'</a> ('.$posts.') <a href="forum/tema.php?id='.$t['id'].'&amp;page='.$tot.'">>></a></div>';
}
?>
