<?php
//----------参数配置----------
$rankrow 	= 10;//显示条数
$day 			= 7;//排行榜时间默认为最近7天

require_once(dirname(__FILE__)."../../../include/common.inc.php");
$ranktime = time()-($day*86400);
function rankw($mood)
{
		global $ranktime,$rankrow;
		$sql = "SELECT count( m.aid ) AS cc, m. * , fs.id, fs.title, fs.filename as url
									FROM `#@__mood_ranking` m
									LEFT JOIN `#@__archives` fs ON `m`.`aid` = `fs`.`ID`
									WHERE `m`.`time` >= $ranktime and `m`.`mood` = $mood
									GROUP BY `m`.`aid` 
									ORDER BY `cc` DESC 
									LIMIT 0 , $rankrow";
		return $sql;
	
}

$dsql = new DedeSql(-100);
$dsql->Execute('m1',rankw(1));
$dsql->Execute('m2',rankw(2));
$dsql->Execute('m3',rankw(3));
$dsql->Execute('m4',rankw(4));
$dsql->Execute('m5',rankw(5));
$dsql->Execute('m6',rankw(6));
$dsql->Execute('m7',rankw(7));
$dsql->Execute('m8',rankw(8));

include_once("mood_ranking.htm");
$dsql->Close();
exit();
?>