<dates>
<?
include_once('../common.php');
if(isset($_REQUEST['length'])){
	$a=$_REQUEST['length'];
$sql="SELECT s.uid, s.username, sf.sex, sf.note ,sf.birthyear FROM ".tname('space')." s LEFT JOIN ".tname('spacefield')." sf ON s.uid=sf.uid ORDER BY s.lastlogin DESC limit $a,20";
$query=mysql_query($sql);
while($result=mysql_fetch_array($query)){	
$name=$result['username'];
	$uid = $result['uid'];
	$sex = $result['sex'];
	$note = $result['note'];
    $name=iconv("gb2312","UTF-8",$name);
	if(empty($note)){$note = "想交个知心朋友...";}else{$note = iconv("gb2312","UTF-8",$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>
		<note><?=$note?></note>
		<tp><?=$tp?></tp>
	</date2>
<?
	}
}else{
$sql="SELECT s.uid, s.username, sf.sex, sf.note ,sf.birthyear FROM ".tname('space')." s LEFT JOIN ".tname('spacefield')." sf ON s.uid=sf.uid ORDER BY s.lastlogin DESC limit 20";
$query=mysql_query($sql);
while($result=mysql_fetch_array($query)){	
$name=$result['username'];
	$uid = $result['uid'];
	$sex = $result['sex'];
	$note = $result['note'];
    $name=iconv("gb2312","UTF-8",$name);
	if(empty($note)){$note = "想交个知心朋友...";}else{$note = iconv("gb2312","UTF-8",$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>
		<note><?=$note?></note>
		<tp><?=$tp?></tp>
	</date>
<?
	}
}
?>
</dates>
