<?php
if(empty($op)) $op='fs';
?>
  <!--- content -->
  <div class="neir">
    <div class="top">好友粉丝</div>
      <div class="content">
		<div class="main_nav">
			<ul>
				<li class="<?php if($op=='hy'){ echo 'nava_4';}else{ echo 'navb_5';}?>"><a href="?ac=friend&op=hy">我的好友</a></li>
				<li class="<?php if($op=='fs'){ echo 'nava_4';}else{ echo 'navb_5';}?>"><a href="?ac=friend&op=fs">我的粉丝</a></li>
				<li class="<?php if($op=='fk'){ echo 'nava_4';}else{ echo 'navb_5';}?>"><a href="?ac=friend&op=fk">我的访客</a></li>
			</ul>
		</div>
		<div class="fd_num">已有1个<?php if($op=='fs'){ echo '粉丝';}elseif($op=='fk'){ echo '访客';}else{ echo '好友';}?></div>
                        <table class="fd_list_tb" cellpadding="0" cellspacing="0">
<?php
     if($op=='hy'){
	$sql="select * from ".Getdbname('friend')." where cs_usera='".$cscms_name."' order by cs_addtime desc";
     }elseif($op=='fk'){
 	$sql="select * from ".Getdbname('funco')." where cs_usera='".$cscms_name."' order by cs_addtime desc";
     }else{
 	$sql="select * from ".Getdbname('fans')." where cs_usera='".$cscms_name."' order by cs_addtime desc";
     }
		$Arr=getuserpage($sql,"4");//sql,每页显示条数
		$result=$db->query($Arr[2]);
		$numdate="a";
		if($result){
			while ($row = $db ->fetch_array($result)){
                        $us=$db->getrow("select * from ".Getdbname('user')." where CS_Name='".$row['CS_Userb']."'");
                        //好友数量
                        $hycount= $db -> num_rows($db -> query("select * from ".Getdbname('friend')." where cs_usera='".$row['CS_Userb']."' and CS_TID=1"));
                        //粉丝数量
                        $fscount= $db -> num_rows($db -> query("select * from ".Getdbname('fans')." where cs_usera='".$row['CS_Userb']."'"));
		        $numdate="b";
?>
                             <tr>
                                  <td class="fd_list_pic"><a href="<?php echo userlink('index',$us['CS_ID'])?>" target="_blank"><img src="<?php echo piclink('logo',$us['CS_Logo'])?>" width="48" height="48" /></a></td>
                                  <td>
                                     <dl class="fd_view">
                                           <dt><a href="<?php echo userlink('index',$us['CS_ID'])?>" target="_blank"><?php echo $row['CS_Userb']?></a>&nbsp;&nbsp;<img class="female" src="images/gender_nan.png" align="middle" /><?php echo $us['CS_City']?></dt>
                                           <dd class="fd_view_info"><span class="fd_view_fow">好友:<a href="<?php echo userlink('hy',$us['CS_ID'])?>" target="_blank"><?php echo $hycount?></a>&nbsp;&nbsp;粉丝:<a href="<?php echo userlink('fs',$us['CS_ID'])?>" target="_blank"><?php echo $fscount?></a></span></dd>
                                           <dd class="huanhang">签名: <?php echo $us['CS_Qianm']?></dd>
                                     </dl>
                                  </td>
                            <?php if($op!='fk'){?>
                                  <td class="fd_list_do"><a onclick="return confirm('确定要删除吗？');" href="javascript:delfriend('<?php echo $row['CS_ID']?>','<?php echo $op?>')">移除<?php if($op=='fs'){ echo '粉丝';}else{ echo '好友';}?></a></td>
                            <?php } ?>
                             </tr>
<?php
	                }
                }
        if($numdate=="a") echo '<tr><td>没有相关记录!</td></tr>';
?>
                        </table>	
		<div class="page">
		<div class="pages">
                       <?php echo $Arr[0];?>
               </div>

	</div>
      </div>
    <div class="end"></div>
  </div>
