<?php

define('_IN_JOHNCMS', 1);

require('../incfiles/core.php');
$headmod = 'fikrlar';
$textl = 'Fikrlar';
require('../incfiles/head.php');

$query = mysql_query("SELECT * FROM `cms_news` WHERE `id`='$id' LIMIT 1;"); 

echo '<div class="header"><b>Oxirgi fikrlar</b></div>';
$count= mysql_query("select count(*)  from `cms_news_comments` where `time`<='". time()."'");
$total= mysql_result($count,0);
if($total>0)

$trans_req= mysql_query("select * from `cms_news_comments` 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);
$kim = mysql_fetch_array(mysql_query("SELECT `id`, `imname` FROM `users` WHERE `id`='".$trans_res['user_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'");
}

echo '<div class="menu"><b><a href="../users/profile.php?user=' . $kim['id'] . '">' . $kim['imname'] . '</a></b>: ' . functions::checkout($trans_res['text'], 2, 1) . ' <a href="/news/index.php?act=view&id=' . $trans_res['refid'] . '"><font color="#006400"> >>></font></a><br /><font color="#888888">' . functions::display_date($trans_res['time']) . '</font>'; if ($rights >= 6) { echo '<a href="/news/index.php?act=comments&mod=delete&id=' . $trans_res['refid'] . '&com=' . $trans_res['id'] . '"><font color="red"> O\'chirish</font></a>'; } echo '</div>';
                ++$i;
            }
if($total>$kmess){
echo'<div class="yangilik" align="center"><p>'. functions::display_pagination('?id='.$id.'&',$start,$total,$kmess).'</p></div>'; } 

require('../incfiles/end.php');
?>
