<?php
error_reporting(0);
switch ($view) {
	case 'points':
		$type="cd_points";
		$types=$CcTvAi_com_points;
		$topye="金币";
		$title="富豪排行榜";
		$title1="金币：";
		break;
	case 'hits':
		$type="cd_hits";
		$types=$CcTvAi_com_hits;
		$topye="人气";
		$title="人气排行榜";
		$title1="人气指数";
		break;
	case 'dj':
		$type="cd_djmub";
		$types=$CcTvAi_com_djmub;
		$topye="分享";
		$title="DJ分享人排行榜";
		$title1="音乐总数";
		break;
	case 'fans':
		$type="cd_ufans";
		$types=$CcTvAi_com_ufans;
		$topye="粉丝";
		$title="粉丝排行榜";
		$title1="粉丝总数";
		break;
	case 'foll':
		$type="cd_ufav";
		$types=$CcTvAi_com_ufav;
		$topye="关注";
		$title="关注排行榜";
		$title1="关注总数";
		break;
	case 'level':
		$type="cd_rank";
		$types="" . getrankname($CcTvAi_com_rank, 1) . " 经验：" . $CcTvAi_com_rank . "";
		$topye="经验";
		$title="等级排行榜";
		$title1="等级：";
		break;
	
}
?>
  <div class="member_content"> 
   <div class="title"> 
    <div class="name">
     <?php echo $title?>
    </div> 
    <div class="number">
     Top100！数据每 10 分钟更新一次。
    </div> 
   </div> 
<?php
if($CcTvAi_com_userid){
$cookie_name = "top_$view";
if($_COOKIE[$cookie_name]) {
$now_pos = $_COOKIE[$cookie_name];
}else{
global $db;
$pos_sql = "SELECT COUNT(*) FROM ".tname('user')." u WHERE u.cd_lock=0 and u.$type>'$types'";
$now_pos = $db->result($db->query($pos_sql), 0);
$now_pos++;
setcookie($cookie_name,$now_pos,time()+600,cd_cookiepath);
}
?>
	<div class="clear">
		<a title="" href="javascript:;" class="photo"><img src="<?php echo linkuserphoto($CcTvAi_com_userid,48); ?>" width="65" height="65"></a>
		<div class="cont"><p>您当前的<?echo $title1?><strong><?php echo $types; ?></strong></p><p>位于榜单中的第<span><?php echo $now_pos; ?></span>位！请再接再厉！</p></div>
	</div>
<?php } ?>
   <div class="box"> 
    <ul> 
<?php
$a=0;
global $db;
$query=$db->query("select * from " . tname('user') . " where cd_lock=0 order by $type desc LIMIT 0,100");
$num=$db->num_rows($query);
if($num==0)
		echo "<div class=\"private_dance_list\"><div class=\"nothing\">暂时没有榜单数据! ^_^</div></div>";
if($query) {
		while($row=$db->fetch_array($query)) {
				$a=$a+1;
				echo '     <li><a title="' . $row['cd_nicheng'] . '" href="' . linkweburl($row['cd_id'], $row['cd_name']) . '" target="_blank"><img src="' . linkuserphoto($row['cd_id'], 200) . '" /></a>
      <div class="box_list">
       <a title="' . $row['cd_nicheng'] . '" href="' . linkweburl($row['cd_id'], $row['cd_name']) . '" target="_blank"><span class="name">' . $row['cd_nicheng'] . '</span></a>
';
				if($row['cd_checkmusic']) {
						echo '<a class="certify" href="javascript:;" title="已获得音乐认证" onclick="openWebsite.openTo(\'musiccertify\');"></a>';
				}
				if($row['cd_checkmm']) {
						echo '<a class="certify_mm" href="javascript:;" title="通过了美女认证" onclick="openWebsite.openTo(\'certify\');"></a>';
				}
				if($row['cd_grade']==1) {
						echo '<a class="vip_style vip10' . getviprank($row['cd_viprank'], 0) . '" title="尊贵的VIP' . getviprank($row['cd_viprank'], 0) . '会员" onclick="openWebsite.openTo(\'vip\');" href="javascript:;"></a>';
				}
				echo ' 		   <span style="float: right;">榜单第：<font size="4" color="red">' . $a . '</font> 名</span>	   ';
       
	   if($view=="level") {
	   echo '<p>等级：'.getrankname($row['cd_rank'],1).'　' . $topye . ':' . $row['cd_rank'] . '　头衔:'.getrankname($row['cd_rank'],2).'</p>';
	   }else{
		 echo '<p>' . $topye . ':' . $row[$type] . '</p>';   
	   }
				if($row['cd_sign']) {
						echo '<p>介绍：' . $row['cd_sign'] . '</p>';
				} else {
						echo '<p>介绍：这家伙很懒，什么也没留下。</p>';
				}
				$sql="select cd_lock from " . tname('friend') . " where cd_uid='$CcTvAi_com_userid' and cd_uids='" . $row['cd_id'] . "'";
				if($rows=$db->getrow($sql)) {
						if($rows['cd_lock']=='1') {
								echo '<a onclick="fans.fansDel(' . $row['cd_id'] . ', \'{' . $row['cd_nicheng'] . '}\', 1);" class="attention mutual" href="javascript:;"></a>';
						} else {
								$cd_groupid=$db->getone("select cd_id from " . tname('friend') . " where cd_uid='$CcTvAi_com_userid' and cd_uids='" . $row['cd_id'] . "'");
								if($cd_groupid) {
										echo '<a onclick="fans.fansDel(' . $row['cd_id'] . ', \'' . $row['cd_nicheng'] . '\', 1);" class="attention already" href="javascript:;"></a>';
								} else {
										echo '<a onclick="fans.fansAdd(' . $row['cd_id'] . ', \'' . $row['cd_nicheng'] . '\', 1);" class="attention" href="javascript:;"></a>';
								}
						}
				} else {
						echo '<a onclick="fans.fansAdd(' . $row['cd_id'] . ', \'{' . $row['cd_nicheng'] . '}\', 1);" class="attention" href="javascript:;"></a>';
				}
				echo '</div>';
				echo '</li>';
		}
}
?>
    </ul> 
   </div> 
  </div>
	<script type="text/javascript" src="<?php echo cd_webpath?>user/static/js/jquery/jquery.min.js"></script>
	<script type="text/javascript" src="<?php echo cd_webpath?>user/static/js/core.js"></script>
	<script type="text/javascript" src="<?php echo cd_webpath?>user/static/js/card.js"></script>
	<script type="text/javascript" src="<?php echo cd_webpath?>user/static/js/dialog.js"></script>
	<script type="text/javascript" src="<?php echo cd_webpath?>user/static/site/js/common.js"></script>
	<script type="text/javascript" src="<?php echo cd_webpath?>user/static/space/js/1relation.js"></script>
	<script type="text/javascript">
	nav.init();
	nav.userMenu();
	libs.checkLogin();
	relation.init();
	select.init('sex');
	select.init('province');
</script>
<?php include_once('source/space_footer.php');?> 
 </body>
</html>