<?php
echo '<div class="header"><b>So\'ngi xabarlar</b></div>';
$count= mysql_query("select count(*)  from `cms_news` where `time`<='". time()."'");
$total= mysql_result($count,0);
if($total>0)
 
$trans_req= mysql_query("select * from `cms_news` where `time`<='". time()."' order by `time` desc limit $start, $kmess;");
 
while($trans_res= mysql_fetch_array($trans_req)){
$comm= mysql_result( mysql_query("select count(*)  from `cms_news_comments` where `refid` = '".$trans_res['id']."'"),0);
$ncount = mysql_fetch_array(mysql_query("SELECT * FROM `cms_news` WHERE `id` ='$id'"));
if (!isset($_SESSION['cms_news']) || isset($_SESSION['cms_news'])&&$_SESSION['cms_news'] != $id) {
$_SESSION['cms_news'] = $id;
$newscount = intval($ncount['count']) + 1;
mysql_query("UPDATE `cms_news` SET `count` ='$newscount'WHERE `id` ='$id'");
}
 
 

$komm = mysql_result(mysql_query("SELECT COUNT(*) FROM `cms_news_comments` WHERE `refid`='{$res['id']}'"), 0);
echo '<div class="menu">'; echo '<span class="newsTime time bottom">' . date('H:i', $trans_res['time'] + (core::$system_set['timeshift'] + core::$user_set['timeshift']) * 3600) . '</span> — <a href="/yangilik_'.$trans_res['id'].'.html"><font color="#454545">'. htmlentities($trans_res['name'],ENT_QUOTES,'UTF-8').'</font></a></div>';
++$i;
}
if($total>$kmess){
echo'<div class="menu" align="center"><p>'. functions::display_pagination('/index.php?id='.$id.'&',$start,$total,$kmess).'</p></div>'; } 

?>
