<?
function CheckID()
{
	if (!isset($_SESSION)) { session_start(); }
	if(!(empty($_SESSION['mAccount'])))
	{ 
	
	return ok;
	/*
		echo "
		<html>
        	<head>
        	<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
        	</head>
        	<body>
        	<script language=javascript>
        	alert('請先登入！');
        	//location.href='../WEB/login.php?url='+location.href;
        	</script>
        	</body>
        	</html>
		";
		*/
	}else {
	
	return no;
	
	}
}


function check_login(){
if (!isset($_SESSION)) { session_start(); }
	if(empty($_SESSION['mAccount']))
	{ 
	

	
		echo "
		<html>
        	<head>
        	<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
        	</head>
        	<body>
        	<script language=javascript>
        	alert('請先登入！');
        	location.href='../member/index.php';
        	</script>
			<noscript>
			請開啟Javascript並登入!!!!
			</noscript>
        	</body>
        	</html>
		";
		
	}

}

function check_msg ($mId)
{
include("../db.php");

$mres = oci_parse($conn,"select * from MESSAGE where IGET='$mId' and IREAD='1'") or die('Insert error');
oci_execute($mres);


$mes="";

if(oci_fetch_all($mres,$result)!=0){
return true;
} 

return false;

}

function CheckaID($mId)
{
	if (!isset($_SESSION)) { session_start(); }
	if(!(empty($_SESSION['mId'])))
	{ 
	 if($mId!=$_SESSION['mId']){

	echo "
		<html>
        	<head>
        	<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
        	</head>
        	<body>
        	<script language=javascript>
        	alert('非發佈會員！');
        	history.go(-1);
        	</script>
        	</body>
        	</html>
		";
	}else {
		
	
		

	
	}
}
}
function CheckrID($mId)
{
	if (!isset($_SESSION)) { session_start(); }
	if(!(empty($_SESSION['mId'])))
	{ 
	
	 if($mId!=$_SESSION['mId']){

	echo "
		<html>
        	<head>
        	<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
        	</head>
        	<body>
        	<script language=javascript>
        	alert('非發佈會員！');
        	history.go(-1);
        	</script>
        	</body>
        	</html>
		";
	}else {
		
	
		

	
	}
}
}

function url_session($id,$c){

if (!isset($_SESSION)) { session_start(); }
	if(!(empty($_SESSION['url'])))
	{ 
       unset($_SESSION['url']);
	   }
	   
	 if($id!=''&&$c!=''){
	   
	   $_SESSION['url']=$_SERVER['PHP_SELF']."?".$c."=".$id;
	   }
	   else{
	    $_SESSION['url']=$_SERVER['PHP_SELF'];
	   
	   }



}

function chk_add_fr($mid,$fmid){
	
	
	
	$num_fr=mysql_num_rows(mysql_query("select * from friend where mId='$mid' and fmId='$fmid'"));
	if($num_fr==0){
		return "ok";
		
	}else {
		
		return "no";
		}
	
	
	
	}
	
	function chk_user($mId)
{
	if (!isset($_SESSION)) { session_start(); }
	if(!(empty($_SESSION['mId'])))
	{ 
	
	if($mId!=$_SESSION['mId'])
	{
		
		
		echo "
		<html>
        	<head>
        	<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
        	</head>
        	<body>
        	<script language=javascript>
        	alert('非本人喔！');
        	location.href='../member/index.php';
        	</script>
        	</body>
        	</html>
		";
		return "no";
		
		}
	/*
		
		*/
	
	
	}
}


?>