<branches>
<?
include_once('../common.php');
//date_default_timezone_set(PRC);
if(isset($_REQUEST['length'])){
	$a=$_REQUEST['length'];
$sql="SELECT bf.message, b.uid,b.subject,b.username,b.work,b.starttime,b.endtime,b.liveid FROM ".tname('live')." b LEFT JOIN ".tname('livefield')." bf ON bf.liveid=b.liveid LEFT JOIN ".tname('space')." s ON s.uid=b.uid WHERE b.endtime>=".$_SGLOBAL['timestamp']." ORDER BY s.experience LIMIT $a,20 ";
$query=mysql_query($sql);
while($value=mysql_fetch_array($query)){	
	$img=UC_API."/data/avatar/".avatar_file($value['uid'], "middle");
	if(file($img)==true){}else{$img="img/ooxx.png";}
	$liveName=iconv("gb2312","UTF-8",$value['subject']);
	$liveid = $value['liveid'];
	$name=iconv("gb2312","UTF-8",$value['username']);
	$work=iconv("gb2312","UTF-8",$value['work']);
	$times=date("Y/m/d H:i",$value['starttime']);
?>
	<branche2>
	<images><?=$img?></images>
	<liveName><?=$liveName?></liveName>
	<liveid><?=$liveid?></liveid>
	<name><?=$name?></name>
	<work><?=$work?></work>
	<times><?=$times?></times>
	</branche2>
<?
	}
}else{
$sql="SELECT bf.message, b.uid,b.subject,b.username,b.work,b.starttime,b.endtime,b.liveid  FROM ".tname('live')." b LEFT JOIN ".tname('livefield')." bf ON bf.liveid=b.liveid LEFT JOIN ".tname('space')." s ON s.uid=b.uid  WHERE b.endtime>=".$_SGLOBAL['timestamp']."  ORDER BY s.experience LIMIT 20";
$query=mysql_query($sql);
while($value=mysql_fetch_array($query)){	
	$img=UC_API."/data/avatar/".avatar_file($value['uid'], "middle");
	if(file($img)==true){}else{$img="img/ooxx.png";}
	$liveName=iconv("gb2312","UTF-8",$value['subject']);
	$liveid = $value['liveid'];
	$name=iconv("gb2312","UTF-8",$value['username']);
	$work=iconv("gb2312","UTF-8",$value['work']);
	$times=date("Y/m/d H:i",$value['starttime']);
?>
	<branche>
	<images><?=$img?></images>
	<liveName><?=$liveName?></liveName>
	<liveid><?=$liveid?></liveid>
	<name><?=$name?></name>
	<work><?=$work?></work>
	<times><?=$times?></times>
	</branche>
<?
	}
}
?>
</branches>