<?
session_start();
header('Content-Type: text/html; charset=utf-8');

if($_POST['page']){$page=$_POST['page'];}else{$page=0;}
if($_COOKIE['v_type']=='t')
{
	$app_name=$_COOKIE['v_appname'];
	require_once './../a_include/read_t_sdk.php';
	$infos=OpenSDK_Tencent_Weibo::call('friends/idollist_s', array('reqnum'=>'30','startindex'=>$page));
	$datas=$infos['data'];
	$infos=$infos['data']['info'];
	if($infos)
	{
		foreach($infos as $key=>$info)
		{
			$avatar=$info['head']!=''?$info['head'].'/50':'../file/imgs/no_avatar.jpg';
			$name=$info['name'];
			$nick=$info['nick'];
			$nick=mb_substr($nick, 0, 6, 'utf-8'); 
	?>
			<li onmouseover="this.className='on';" onmouseout="this.className='';"  onclick="on_submit('<?=$name?>','<?=$nick?>');">
			  <img src="<?=$avatar?>" title="查看Ta的，并发送微博" />
			  <div><a href="javascript:void(0);" title="查看Ta的，并发送微博" ><?=$nick?></a></div>
			</li>
	<?  		
			if($datas['hasnext']=='1')
			{
				echo '<p id="null" style="display:none">&nbsp;</p>';
			}
		}
	}
	else
	{
		echo '<p id="null">加载失败，请刷新...</p>';
	}
}//end if($_COOKIE['v_type']=='t')
elseif($_COOKIE['v_type']=='s')
{
	require_once './../a_include/read_s_sdk.php';
	$screen_name=$_COOKIE['v_name'];
	$datas = OpenSDK_Sina_Weibo2::call('friendships/friends', array('screen_name'=>$screen_name,'count'=>30,'cursor'=>$page));
	$infos=$datas['users'];
	if($infos)
	{
		foreach($infos as $key=>$info)
		{
			$avatar=$info['profile_image_url'];
			$avatar=$avatar!=''?$avatar:'../file/imgs/no_avatar.jpg';
			//$name=$info['id'];
			$name=$info['screen_name'];
			$nick=$info['screen_name'];
			$nick=mb_substr($nick, 0, 6, 'utf-8'); 
	?>
			<li onmouseover="this.className='on';" onmouseout="this.className='';"  onclick="on_submit('<?=$name?>','<?=$nick?>');">
			  <img src="<?=$avatar?>" title="查看Ta的，并发送微博"/>
			  <div><a href="javascript:void(0);" title="查看Ta的，并发送微博" ><?=$nick?></a></div>
			</li>
	<?  		
			if($datas['next_cursor']=='0')
			{
				echo '<p id="null" style="display:none">&nbsp;</p>';
			}
		}
	}
	else
	{
		echo '<p id="null">加载失败，请刷新...</p>';
	}
}
?>
