<?php
error_reporting(0);
if($ac == "profile" and $view == "") {
    $title="个人资料";
} elseif($ac == "profile" and $view == "applyCertify") {
    $title="申请美女认证";
} elseif($ac == "upmusic" and $view == "") {
    $title="我的音乐";
} elseif($ac == "music" and $view == "passed") {
    $title="待审音乐";
} elseif($ac == "music" and $view == "upload") {
    $title="上传音乐";
} elseif($ac == "music" and $view == "help") {
    $title="音乐帮助";
} elseif($ac == "music" and $view == "up") {
    $title="发布音乐";
} elseif($ac == "video" and $view == "") {
    $title="我的视频";
} elseif($ac == "upvideo" and $view == "passed") {
    $title="待审视频";
} elseif($ac == "video" and $view == "list") {
    $title="已审视频";
} elseif($ac == "gdmusic" and $view == "") {
    $title="我喜欢的音乐";
} elseif($ac == "gdmusic" and $view == "dislike") {
    $title="我讨厌的音乐";
} elseif($ac == "gdmusic" and $view == "favorites") {
    $title="我收藏的音乐";
} elseif($ac == "gdmusic" and $view == "down") {
    $title="我下载的音乐";
} elseif($ac == "malbum" and $view == "") {
    $title="我的音乐专辑";
} elseif($ac == "malbum" and $view == "passed") {
    $title="待审音乐专辑";
} elseif($ac == "malbum" and $view == "list") {
    $title="已审音乐专辑";
} elseif($ac == "malbum" and $view == "song") {
    $title="添加到我的音乐专辑";
} elseif($ac == "valbum" and $view == "") {
    $title="我的视频专辑";
} elseif($ac == "valbum" and $view == "passed") {
    $title="待审视频专辑";
} elseif($ac == "valbum" and $view == "list") {
    $title="已审视频专辑";
} elseif($ac == "valbum" and $view == "song") {
    $title="添加到我的视频专辑";
} elseif($ac == "miniblog" and $view == "") {
    $title="我的说说";
} elseif($ac == "miniblog" and $view == "following") {
    $title="关注的说说";
} elseif($ac == "pic" and $view == "") {
    $title="我的照片";
} elseif($ac == "pic" and $view == "imageSpaceSort") {
    $title="空间首页照片排序";
} elseif($ac == "pic" and $view == "imageSort") {
    $title="照片重新排序";
} elseif($ac == "pic" and $view == "following") {
    $title="好友的照片";
} elseif($ac == "message" and $view == "") {
    $title="全部通知";
} elseif($ac == "assets" and $view == "") {
    $title="个人账户";
} elseif($ac == "assets" and $view == "scoreBill") {
    $title="我的账单详情";
} elseif($ac == "assets" and $view == "topup") {
    $title="在线充值";
} elseif($ac == "assets" and $view == "vip") {
    $title="办理VIP";
} elseif($ac == "assets" and $view == "pointsorder") {
    $title="充值订单";
} elseif($ac == "wall" and $view == "") {
    $title="我的留言";
} elseif($ac == "pm" and $view == "") {
    $title="消息列表";
} elseif($ac == "album" and $view == "") {
    $title="乐迷相册";
} elseif($ac == "album" and $view == "new") {
    $title="最新上传照片";
} elseif($ac == "privilege" and $view == "") {
    $title="已通过认证的美女";
} elseif($ac == "list" and $view == "points") {
    $title="富豪排行榜";
} elseif($ac == "list" and $view == "hits") {
    $title="人气排行榜";
} elseif($ac == "list" and $view == "dj") {
    $title="DJ分享人排行榜";
} elseif($ac == "list" and $view == "level") {
    $title="等级排行榜";
} elseif($ac == "list" and $view == "foll") {
    $title="关注排行榜";
} elseif($ac == "list" and $view == "fans") {
    $title="粉丝排行榜";
} elseif($ac == "friend" and $view == "") {
    $title="我的关注";
} elseif($ac == "user" and $view == "") {
    $title="活跃会员";
} elseif($ac == "error" and $view == "") {
    $title="信息报错";
} else {
    $title="会员中心";
}
//对话框
function showmessage($ErrMsg, $ErrUrl, $ErrType) {
	if($ErrType==3) {
		echo "<script language=javascript>alert('" . $ErrMsg . "');history.back(1);</script>";
	} else {
		echo "<div class=\"x5-ajax-tips\"> <dl class=\"x5-ajax-tips-text\"> <dt>系统提醒：</dt> <dd>" . $ErrMsg . "</dd> <dd class=\"right\"><a href='" . $ErrUrl . "'>如果您的浏览器没有自动转跳请点这里!</a></dd> </dl></div>";
		if($ErrType==1) {
			echo "<script>setTimeout(\"window.location.href ='" . $ErrUrl . "';\", 3000);</script>";
		} elseif($ErrType==2) {
			echo "<script>setTimeout(\"history.back(1);\", 3000);</script>";
		} else {
			echo "<script>setTimeout(\"window.location.href ='" . $ErrUrl . "';\", 3000);</script>";
		}
	}
	include "space_bottom.php";
	exit();
}
//获取在线IP
function getonlineip($format = 0) {
	global $_SGLOBAL;

	if(empty($_SGLOBAL['onlineip'])) {
		if(getenv('HTTP_CLIENT_IP') && strcasecmp(getenv('HTTP_CLIENT_IP'), 'unknown')) {
			$onlineip=getenv('HTTP_CLIENT_IP');
		} elseif(getenv('HTTP_X_FORWARDED_FOR') && strcasecmp(getenv('HTTP_X_FORWARDED_FOR'), 'unknown')) {
			$onlineip=getenv('HTTP_X_FORWARDED_FOR');
		} elseif(getenv('REMOTE_ADDR') && strcasecmp(getenv('REMOTE_ADDR'), 'unknown')) {
			$onlineip=getenv('REMOTE_ADDR');
		} elseif(isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], 'unknown')) {
			$onlineip=$_SERVER['REMOTE_ADDR'];
		}
		preg_match("/[\d\.]{7,15}/", $onlineip, $onlineipmatches);
		$_SGLOBAL['onlineip']=$onlineipmatches[0] ? $onlineipmatches[0] : 'unknown';
	}
	if($format) {
		$ips=explode('.', $_SGLOBAL['onlineip']);
		for($i=0; $i<3; $i++) {
			$ips[$i]=intval($ips[$i]);
		}
		return sprintf('%03d%03d%03d', $ips[0], $ips[1], $ips[2]);
	} else {
		return $_SGLOBAL['onlineip'];
	}
}
function check_email($email){
	if (ereg('^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+',$email)){
		return true;
		}else{
			return false;
			}
}

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;
	}
	$pagejs=ceil($nums/$pagesok); //总页数
	if($pages>$pagejs) {
		$pages=$pagejs;
	}
	$sql=$sqlstr . " LIMIT " . $pagesok*($pages-1) . "," . $pagesok;
	$result=$db->query($sql);
	if($pagejs>1) {
		if($pages>0) {
			$str.="<a href=\"?" . $url . "pages=" . ($pages-1) . "\" target=\"_self\">上一页</a>　　　";
		}
		if($pages<$pagejs) {
			$str.="<a href=\"?" . $url . "pages=" . ($pages+1) . "\" target=\"_self\">下一页</a>";
		}
	}
	while($row=$db->fetch_array($result)) {
	}
	$arr=array(
		$str,
		$result,
		$sql,
		$pagejs
	);
	return $arr;
}
?>