<?php
define('IN_PHPMPS', true);
require dirname(__FILE__) . '/include/common.php';

$comid = empty($_REQUEST['comid']) ? 0 : intval($_REQUEST['comid']);
$page = empty($_REQUEST['page'])? 1: intval($_REQUEST['page']);
$count = $db->getOne("SELECT COUNT(*) FROM {$table}com_comment WHERE is_check=1 and comid = '$comid'");
$pager['search'] = array('comid' => $comid);
$pager = get_pager('com_comment.php', $pager['search'], $count, $page, '5');
$sql = "SELECT a.*,b.username,b.face FROM {$table}com_comment as a left join {$table}member as b on a.userid=b.userid WHERE comid = '$comid' AND is_check = 1 ORDER by a.id DESC LIMIT $pager[start],$pager[size]";
$res = $db->query($sql);
$comment = array();
while($row = $db->fetchRow($res)) {
	$row['username'] = $row['username'] ? $row['username'] : '本站网友' ;
	$row['face'] = empty($row['face']) ? $CFG['thumbs'] : $row['face'];
	$row['cm_jgs'] = floor($row['cm_jg']*(100/3));
		$row['cm_pzs'] = floor($row['cm_pz']*(100/3));
		$row['cm_fws'] = floor($row['cm_fw']*(100/3));
		$row['cm_hjs'] = floor($row['cm_hj']*(100/3));
		$row['postdate'] = mdate($row['postdate']);
		$row['retime'] = mdate($row['retime']);
	$comment[] = $row;
}
include template('com_comment');
?>