<?php
require_once('header.php');
include_once("classes/pageclass.php");

$page=intval($_GET["page"]);
if ($page==0) $page=1;


$map_nav = '下载排行榜';

$sql = "select m.*,cm.category_id,cm.hits_num,cm.down_num,cm.fav_num,pic.thumbnail_path from {$tablepre}message m 
        inner join {$tablepre}categorymng cm on cm.msg_id=m.msg_id
	    inner join {$tablepre}attachmng pic ON pic.msg_id = m.msg_id
	    where pic.index_box=1 and m.msg_status=1 and m.msg_starttime<='".$getnow."' and m.msg_endtime>='".$getnow."' 
		GROUP BY cm.msg_id order by cm.down_num desc limit 20"; 	   
$ListArray = $db->get_all($sql);


include($template->getfile('downtop'));
?>