帮助我加快这个
function _NEW_COMPRESS_USER($master,$level,$str='',$YEAR_ID,$MON_ID,$Firsttime){
global $db;
global $_sath;
global $_UP_LEVEL;
if ($Firsttime){$_UP_LEVEL=$level+1;}
if($level!=0){
$user=$db->select('SELECT tbl_users.*,`tbl_user_active`.main_tain AS mn, `tbl_user_active`.*
FROM tbl_users inner join `tbl_user_active` on `tbl_users`.`id`=`tbl_user_active`.`user_id` WHERE tbl_users.mode<>2 AND
`tbl_user_active`.month='.$MON_ID.' AND `tbl_user_active`.year='.$YEAR_ID.' AND tbl_users.upuser_id ="'.$master.'" ');
for($i=0;$i<count($user);$i++){
if(($user[$i]['mn']==1) && ($user[$i]['mode']==1) && ($user[$i]['year']==$YEAR_ID) && ($user[$i]['month']==$MON_ID) ){
if(($_UP_LEVEL-$level)==1){$_sath++;}
$str0.=$user[$i][0].sprintf('%02s',($_UP_LEVEL-$level)).sprintf('%02s',($_sath))._NEW_COMPRESS_USER($user[$i][0],$level-1,$str0,$YEAR_ID,$MON_ID,false);
}else{
$str0.=_NEW_COMPRESS_USER($user[$i][0],$level,$str0,$YEAR_ID,$MON_ID,false) ;}
}
return $str0;
}