<?php
if(S_VipFun==0){exit("本站会员功能已经关闭!");}
if($ac=='edit'and $op=='zl'){
$title='个人设置';
}elseif($ac=='edit'and $op=='pwd'){
$title='修改密码';
}elseif($ac=='edit'and $op=='logo'){
$title='修改头像';
}elseif($ac=='qq'){
$title='在线帮定QQ登入';
}elseif($ac=='fav'){
$title='我的收藏夹';
}elseif($ac=='pm'){
$title='我的短消息';
}elseif($ac=='friend'and $op==''){
$title='我的好友';
}elseif($ac=='friend'and $op=='friendList'){
$title='好友列表';
}elseif($ac=='friend'and $op=='visitorIn'){
$title='最近访客';
}elseif($ac=='article'){
$title='我的文章';
}elseif($ac=='online'){
$title='在线会员';
}elseif($ac=='message'and $op=='tz'){
$title='全部通知';
}elseif($ac=='message'and $op=='hy'){
$title='好友请求';
}elseif($ac=='pay'){
$title='购买点/月卡';
}elseif($ac=='pic'){
$title='我的相册';
}elseif($ac=='blog'){
$title='我的微薄客';
}elseif($ac=='music'){
$title='我的音乐';
}elseif($ac=='gbook'){
$title='我的留言';
}elseif($ac=='topic'){
$title='我的专辑';
}elseif($ac=='down'){
$title='我的下载记录';
}elseif($ac=='bfriend'){
$title='粉丝列表';
}elseif($ac=='look'){
$title='访问脚印';
}elseif($ac=='paycz'){
$title='在线充值';
}elseif($ac=='change'){
$title='会员在线升级';
}elseif($ac=='web'){
$title='会员主页装扮';
}else{
$title='会员首页';
}
if(isset($_COOKIE["s_name"])){
	$S_Name=$_COOKIE["s_name"];
}
else{
	$S_Name="";
}
if(isset($_COOKIE["s_id"])){
	$S_UID=$_COOKIE["s_id"];
}
else{
	$S_UID="";
}
//--------------------------- Ucenter ---------------------------

//--------------------------- Ucenter ---------------------------
$sql= "select s_id from s_users where S_Name='".$S_Name."' and S_id='".$S_UID."' ";
$s_id= $db->Getone($sql);
if(!$s_id){
$chsh_username="游客";
$chsh_userid=0;
$chsh_userpwd=000;
$chsh_nicheng="游客";
$chsh_question="";
$chsh_answer="";
$chsh_logo="";
$chsh_sex="未知";
$chsh_city="未知";
$chsh_email="未知";
$chsh_qq="未知";
$chsh_hits=88888;
$chsh_leve="游客";
$chsh_loghits=0;
$chsh_usertype=0;
$chsh_type="剩余点数：";
$chsh_hylx="未知";
$chsh_points=0;
$chsh_rmb=0;
$chsh_qqid="no";
$userlogin=NULL;
$chsh_top="top.gif";
$chsh_bg="bg.gif";
$chsh_qm="这家伙很懒，什么也没有留下！";
}
else{
global $db;
$sql1="select * from s_users where S_Name='".$S_Name."'";
$rs1=$db->query($sql1);
$row1=$db->fetch_array($rs1);
$chsh_qm=str_decode($row1["S_Qianm"]);
$chsh_userid=$row1["S_ID"];
$chsh_username=$row1["S_Name"];
$chsh_nichend=$row1["S_RealName"];
$chsh_userpwd=$row1["S_PassWord"];
$chsh_nicheng=$row1["S_RealName"];
$chsh_question=$row1["S_Question"];
$chsh_answer=$row1["S_Answer"];
$chsh_logo=$row1["S_Logo"];
$chsh_sex=$row1["S_Sex"];
$chsh_city=$row1["S_City"];
$chsh_mb=$row1["S_Mbid"];
$chsh_kc=$row1["S_Kcid"];
$chsh_tx=$row1["S_Txid"];
$chsh_cur=$row1["S_Cur"];
$chsh_email=$row1["S_Email"];
$chsh_qq=$row1["S_QQ"];
$chsh_hits=$row1["S_Hits"];
//$chsh_bg=$row1["S_Bgpic"];
//$chsh_top=$row1["S_Toppic"];
//$chsh_bo=$row1["S_Bopic"];
$chsh_loghits=$row1["S_LogNum"];
$chsh_usertype=$row1["S_UseType"];
$chsh_rmb=$row1["S_RMB"];
if($chsh_top=="") $chsh_top="top.gif";
if($chsh_bg=="") $chsh_bg="bg.gif";
if($chsh_bo=="") $chsh_bo="bo.gif";
if(($row1["S_Qqid"]=="") || ($row1["S_Qqid"]=="NULL")){$chsh_qqid="no";}else{$chsh_qqid="yes";}
if($row1["S_UseType"]==0){$chsh_type="剩余点数：";}else{$chsh_type="到期时间：";}
if($row1["S_UseType"]==0){$chsh_hylx="耗点";}else{$chsh_hylx="包月";}
if($row1["S_UseType"]==0){$chsh_points=$row1["S_Coin"];}else{$chsh_points=$row1["S_UseDate"];}
$chsh_cion=$row1["S_Coin"];
$userlogin=true;
if($chsh_qm=="") $chsh_qm="这家伙很懒，什么也没有留下！";
}
////////
function showmessage($ErrMsg,$ErrUrl,$ErrType){
echo "<div class='regMain' id='regData'><div class='title'><div class='name'>系统提示</div>";
echo "<li><span style='font-size:14px;color:#ff0000;'>".$ErrMsg."</span></li>";
if($ErrType==3){
echo "<script>setTimeout(\";window.close();\", 3000);</script>";
echo '</div></div></div><div class="regBottom"><div class="defaultHomeBottom"></div></div>';
}else{
if($ErrType==1){
echo "<script>setTimeout(\"window.location.href ='".$ErrUrl."';\", 2000);</script><li><span style='font-size:14px;color:#ff0000;'><a href='".$ErrUrl."'>页面跳转中...</a></span></li>";
}elseif($ErrType==2){
echo "<li><span style='font-size:14px;color:#ff0000;'><script>setTimeout(\"history.back(1);\", 2000);</script><a href='javascript:history.go(-1);'>返回上一页</a> |";
echo "<a href='space.php?do=home'>返回首页</a></span></li>";
}else{
echo "<li><span style='font-size:14px;color:#ff0000;'><script>setTimeout(\"window.location.href ='".$ErrUrl."';\", 2000);</script><a href='".$ErrUrl."'>返回上一页</a> |";
echo "<a href='space.php?do=home'>返回首页</a></span></li>";
}
echo '</ul></div>';
echo '</div></div><div class="defaultHomeBottom"></div></div><div class="regBottom"><div class="userBottom">';
echo '本站仅提供音乐作品DJ版本的推广及发布服务，所有音乐的版权归各音乐公司及作者所有<br />Copyright ? 2012 PjRen.Net All Rights Reserved</div></div>';
}
exit();
}
//分页
passport_User();
function getuserpage($mysql,$pagesize){
	global $db;
	$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");
	$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;}
 	$str="<em>".$nums."</em>";
    $pagejs=ceil($nums/$pagesok);//总页数
  
    if($pages>$pagejs){
     $pages=$pagejs;
    }
  
    $sql=$sqlstr." LIMIT ".$pagesok*($pages-1).",".$pagesok;
	//$str.="当前<font color=red>".$pages."/</font>".$pagejs."页&nbsp;</a>";                                                              ;
	$result = $db -> query($sql);
	//$str.= "<a href=?".$url."pages=1><<</a>";
	if($i>1){
	$str.="<a href=?".$url."pages=".($pages-1)."><<</a>";
 	 	}
	if($pagejs<=10){
  		for($i=1;$i<=$pagejs;$i++){
   			//$str.="<strong><a href='?".$url."pages=".$i."'>".$i."</a></strong>";
   			$str.="<strong>".$i."</strong>";
 	 	}
	}
	else{
 		if($pages>=12){
 			for($i=$pages-5;$i<=$pages+6;$i++){
   				if($i<=$pagejs){
   					$str.="<a href='?".$url."pages=".$i."'>".$i."</a>";
    			}
  			}
  			if($i<=$pagejs){ 
    			//$str.="....";
	    		$str.="<a href='?".$url."pages=".$pagejs." '>".$pagejs."</a>";
   			}
   		}
  		else{
  			for($i=1;$i<=12;$i++){
    			$str.="<a href='?".$url."pages=".$i." '>".$i."</a>";
 		} 
 				if($i<=$pagejs){ 
      				//$str.="....";
	  				$str.="<a href='?".$url."pages=".$pagejs." '>".$pagejs."</a>";
    			}
 		 }
	}
	if($pagejs>1){
	$str.="<a href=?".$url."pages=".($pages+1).">>></a>";
	}
	//$str.="<a href=?".$url."pages=".$pagejs.">最后页</a>&nbsp;";
	 while ($row = $db -> fetch_array($result) ){}
	 $arr=array($str,$result,$sql,$pagejs);
	 return $arr;
}

//判断图片类型
function file_type($filename)   
{   
    $file = fopen($filename, "rb");   
    $bin = fread($file, 2); //只读2字节   
    fclose($file);   
    $strInfo = @unpack("C2chars", $bin);   
    $typeCode = intval($strInfo['chars1'].$strInfo['chars2']);   
    $fileType = '';   
    switch ($typeCode)   
    {   
        case 7790:   
            $fileType = 'exe';   
            break;   
       case 7784:   
            $fileType = 'midi';   
            break;   
        case 8297:   
            $fileType = 'rar';   
            break;           
        case 8075:   
            $fileType = 'zip';   
           break;   
        case 255216:   
            $fileType = 'jpg';   
            break;   
        case 7173:   
            $fileType = 'gif';   
            break;   
        case 6677:   
            $fileType = 'bmp';   
            break;   
        case 13780:   
            $fileType = 'png';   
            break;   
        default:   
            $fileType = 'unknown: '.$typeCode;   
    }   
  
    //Fix   
    if ($strInfo['chars1']=='-1' AND $strInfo['chars2']=='-40' ) return 'jpg';   
    if ($strInfo['chars1']=='-119' AND $strInfo['chars2']=='80' ) return 'png';   
  
    return $fileType;   
} 
?>