<?php
define('IN_PHPQUAN', true);
require dirname(__FILE__) . '/include/common.php';
require dirname(__FILE__) . '/include/com.fun.php';
$durl = 'index';
$cat_array = get_cat_array();
$sql = "select a.*,a.id as aid,a.catid as aaid,b.comid,b.catid as bid,b.comname,count(c.juanid) as ujid from (select * from {$table}juan ORDER by postdate DESC) as a left join {$table}com as b on a.comid=b.comid left join {$table}juan_user as c on a.id=c.juanid where a.enddate>=".time()." and a.is_check=1 group by a.id order by a.postdate DESC LIMIT 5";
$res = $db->query($sql);
$juan = array();
	while($row=$db->fetchRow($res)) {
		$row['catcolor'] = $cat_array[$row['aaid']][1];
		$row['url']      = url_rewrite('view',array('vid'=>$row['aid']));
		$row['comurl']   = url_rewrite('com',array('act'=>'view','comid'=>$row['comid']));
		$row['mystat']	 = round($row['ujid']/$row['nums'] * 100 , 0);
		$juan[$row['id']] = $row;
	}
$seo['title'] = $CFG['webname'];
$seo['keywords'] = $CFG['keywords'];
$seo['description'] = $CFG['description'];
include template('index');
?>