<?php
if(S_VipFun==0){exit("本站会员功能已经关闭!");}
if(!IsNul($u)){
   exit ("<script>window.location='http://www.mc526.com/404.html?result=1';</script>");
}else{
global $db;
passport_User();
$sql="select * from s_users where S_State=0 and S_Name='".$u."'";
$result=$db->query($sql);
if($row=$db->fetch_array($result)){
$chsh_web_userid=$row["S_ID"];
$chsh_web_mb=$row["S_Mbid"];
$chsh_web_top=$row["S_Toppic"];
$chsh_web_bg=$row["S_Bgpic"];
$chsh_web_name=$row["S_Name"];
$chsh_web_qm=$row["S_Qianm"];
$chsh_web_logo=S_SiteDomain."/upload/userlogo/big".$row["S_Logo"];
$chsh_web_sex=$row["S_Sex"];
if($chsh_web_sex==1){
$chsh_web_sex="帅哥";
}else{
$chsh_web_sex="美女";
}
if($chsh_web_mb=="") $chsh_web_mb="01";
if($chsh_web_top=="") $chsh_web_top="top.gif";
if($chsh_web_bg=="") $chsh_web_bg="bg.gif";
if($chsh_web_qm=="") $chsh_web_qm="这家伙很懒，什么也没有留下！";
$chsh_web_nicheng=$row["S_RealName"];
$chsh_web_logintime=$row["S_LogTime"];
$chsh_web_qq=$row["S_QQ"];
$chsh_web_city=$row["S_City"];
$chsh_web_email=$row["S_Email"];
$chsh_web_hits=$row["S_Hits"];
$chsh_web_loghits=$row["S_LogNum"];
$chsh_web_leve=$row["S_Type"];
$chsh_web_dhits=$row["S_Dhits"];
$chsh_web_addtime=$row["S_CreateTime"];
if($row["S_UseType"]==0){$chsh_web_type="剩余点数：";$chsh_web_hylx="耗点";$chsh_web_cion=$row["S_Coin"];}else{$chsh_web_type="到期时间：";$chsh_web_hylx="包月";$chsh_web_cion=$row["S_UseDate"];}
$chsh_web_xfms=$chsh_web_type.$chsh_web_cion;
//判断是否在线
$TimeTime=$row["S_LogTime"];
$limit=time()-strtotime($TimeTime);
  if ($limit < 1800) {
     $chsh_web_zx="在线";
  }else{
     $chsh_web_zx="<font color=#CCCCCC>离线</font>";
  }
if($row["S_UseType"]==0){$chsh_web_type="剩余点数：";}else{$chsh_web_type="到期时间：";}
if($row["S_UseType"]==0){$chsh_web_points=$row["S_Coin"];}else{$chsh_web_points=$row["S_UseDate"];}
//会员被锁定
if($row["S_State"]==1)   exit ("<script>window.location='http://www.mc526.com/404.html?result=2';</script>");
}else{
    exit ("<script>window.location='http://www.mc526.com/404.html?result=1';</script>");
}
}
if($op=='music'){
$title=$chsh_web_nicheng."的最新舞曲";
}elseif($op=='fav'){
$title=$chsh_web_nicheng."的收藏夹";
}elseif($op=='pic'){
$title=$chsh_web_nicheng."的相册";
}elseif($op=='picgo'){
$title=$chsh_web_nicheng."查看相片详细内容";
}elseif($op=='blog'){
$title=$chsh_web_nicheng."的文章";
}elseif($op=='friend'){
$title=$chsh_web_nicheng."的好友";
}elseif($op=='book'){
$title=$chsh_web_nicheng."的留言";
}elseif($op=='down'){
$title=$chsh_web_nicheng."的下载列表";
}elseif($op=='fs'){
$title=$chsh_web_nicheng."的嗨友团";
}else{
$title=$chsh_web_nicheng."的个人主页";
}
if($op=='index'){
$db->query("update s_users set S_Hits=S_Hits+1 where s_ID=$chsh_web_userid");
}

//分页
function getuserpage($mysql,$pagesize){
	global $db;
        $op=SafeRequest("op","get","filter");
        if(S_Usermode==0){
           $url=$op."----";
        }else{
	    $url=$_SERVER["QUERY_STRING"];
	    if(stristr($url,'&pages')){
		$url=preg_replace('/&pages=([\S]+?)$/','',$url);
	    }
	    if(stristr($url,'pages')){
		$url=preg_replace('/pages=([\S]+?)$/','',$url);
	    }
	    if(IsNul($url)){$url.="&";}
        }
	$pages=SafeRequest("pages","get","filter");
	$pagesok=$pagesize;//每页显示记录数
    if (!isset($pages)||$pages==""||!is_numeric($pages)||$pages<=0){
    $pages=1;
	}
  	$sqlstr=$mysql;
  	$res=$db -> query($sqlstr);
 	$nums= $db -> num_rows($res);
	if($nums==0){$nums=1;}
    $pagejs=ceil($nums/$pagesok);//总页数
  
    if($pages>$pagejs){
     $pages=$pagejs;
    }
 if(S_Usermode==0){
  $str="&nbsp;页数：".$pages."/".$pagejs."&nbsp; <a href=/".$url."1.html>首页</a>&nbsp;";
 }else{
  $str="&nbsp;页数：".$pages."/".$pagejs."&nbsp; <a href=?".$url."pages=1>首页</a>&nbsp;";
 }
    $sql=$sqlstr." LIMIT ".$pagesok*($pages-1).",".$pagesok;                                                          ;
	$result = $db -> query($sql);
	if($pages>1){
 if(S_Usermode==0){
	$str.="<a href=/".$url.($pages-1).".html>上一页</a>&nbsp;";
 }else{
	$str.="<a href=?".$url."pages=".($pages-1).">上一页</a>&nbsp;";
 }
 	 	}
	if($pagejs>1){
 if(S_Usermode==0){
	$str.="<a href=/".$url.($pages+1).".html>下一页</a>&nbsp;";
 }else{
	$str.="<a href=?".$url."pages=".($pages+1).">下一页</a>&nbsp;";
 }
	}
  $str.="<a href=/".$url.$pagejs.".html>尾页</a>&nbsp;共<font color=red>".$nums."</font>条记录";
	 while ($row = $db -> fetch_array($result) ){}
	 $arr=array($str,$result,$sql,$pagejs);
	 return $arr;
}
?>