getTime(1)) { update(); } $db->select_db("act"); $sql = "select * from luanshi_act_rank where type = 0 order by rank asc limit 5"; $result = $db->result($sql); $list = array(); for ($i = 0; $i < count($result); $i++) { $list[$i]['rank'] = $result[$i]['rank']; $list[$i]['username'] = substr_replace($result[$i]['username'],"****",strlen($result[$i]['username']) - 4); $list[$i]['value'] = $result[$i]['value']/100; } $time = date("Y年m月d日 H点i分",$ts->getLastTime()); $smarty->assign("list",$list); $smarty->assign("time",$time); $smarty->display("mygame_luanshi_payment_rank.html"); function update() { global $db; $sql = "select sum(value) as cnt,user_account from gameb_sg_gameconsume where type = 0 and status = 1 and buy_date >= '2007-11-16 15:00:00' and buy_date <= '2007-11-25 23:59:59' GROUP BY user_account order by cnt desc"; $result = $db->result($sql); if (!is_array($result) || count($result) < 1) return false; $db->select_db("act"); $sql = "delete from luanshi_act_rank where type = 0"; $db->query($sql); foreach($result as $k=>$v) { $rank = $k+1; $sql = "insert into luanshi_act_rank set rank = '$rank',username = '".$v['user_account']."', value = '".$v['cnt']."'"; $db->query($sql); } return true; } ?>