<dates>
<?
include_once('../common.php');
if(isset($_REQUEST['length'])){
	$a=$_REQUEST['length'];
$sql="SELECT s.uid, s.username, sf.sex, sf.note ,sf.birthyear, m.work FROM ".tname('space')." s LEFT JOIN ".tname('spacefield')." sf ON s.uid=sf.uid LEFT JOIN ".tname('major')." m ON s.uid=m.u_id LEFT JOIN ".tname("collate")." c ON s.uid=c.u_id WHERE c.collated=1 ORDER BY s.lastlogin DESC limit $a,20";
$query=mysql_query($sql);
while($result=mysql_fetch_array($query)){	
	$uid = $result['uid'];
	$sex = $result['sex'];
    $name=iconv("gb2312","UTF-8",$result['username']);
	if(empty($result['work'])){$work = "保密";}else{$work = iconv("gb2312","UTF-8",$result['work']);}
	if(empty($result['note'])){$note = "暂未更新签名";}else{$note = iconv("gb2312","UTF-8",$result['note']);}
	if($uid<10){$tp=UC_API."/data/avatar/000/00/00/0".$uid."_avatar_middle.jpg";}else{$tp=UC_API."/data/avatar/000/00/00/".$uid."_avatar_middle.jpg";}
	if(file($tp)==true){}else{$tp="img/ooxx.png";}
?>
	<date2>
		<uuid><?=$uid?></uuid>
		<name><?=$name?></name>
		<sex><?=$sex?></sex>
		<work><?=$work?></work>
		<note><?=$note?></note>
		<tp><?=$tp?></tp>
	</date2>
<?
	}
}else{
$sql="SELECT s.uid, s.username, sf.sex, sf.note ,sf.birthyear, m.work FROM ".tname('space')." s LEFT JOIN ".tname('spacefield')." sf ON s.uid=sf.uid LEFT JOIN ".tname('major')." m ON s.uid=m.u_id LEFT JOIN ".tname("collate")." c ON s.uid=c.u_id WHERE c.collated=1 ORDER BY s.lastlogin DESC limit 20";
$query=mysql_query($sql);
while($result=mysql_fetch_array($query)){	
	$uid = $result['uid'];
	$sex = $result['sex'];
    $name=iconv("gb2312","UTF-8",$result['username']);
	if(empty($result['work'])){$work = "保密";}else{$work = iconv("gb2312","UTF-8",$result['work']);}
	if(empty($result['note'])){$note = "暂未更新签名";}else{$note = iconv("gb2312","UTF-8",$result['note']);}
	if($uid<10){$tp=UC_API."/data/avatar/000/00/00/0".$uid."_avatar_middle.jpg";}else{$tp=UC_API."/data/avatar/000/00/00/".$uid."_avatar_middle.jpg";}
	if(file($tp)==true){}else{$tp="img/ooxx.png";}
?>
	<date>
		<uuid><?=$uid?></uuid>
		<name><?=$name?></name>
		<sex><?=$sex?></sex>
		<work><?=$work?></work>
		<note><?=$note?></note>
		<tp><?=$tp?></tp>
	</date>
<?
	}
}
?>
</dates>
