<?php
class Admin
{
	/*
	function userOnLine()
	{

		if($_SESSION["webUser"]["use_id"] =='' or  $_SESSION["webUser"]["use_name"] =='' or  $_SESSION["webUser"]["use_email"] =='' )
		{
			header("location:".ADMIN_WEBURL."/index.php?load=login&act=act");
			exit();
			//header("location:".WEBBASE_URL.ROOT_URL."login/act/");
		}
	}
	*/
	function online_admin()
	{
	
		if($_SESSION["admin"]["adm_id"] =='' or  $_SESSION["admin"]["adm_user"] =='' or  $_SESSION["admin"]["adm_email"] =='' )
		{
			header("location:".ADMIN_WEBURL."/index.php?load=login&act=act");
			exit();
		}
		
	}


	function drop_admin_session()
	{
		unset($_SESSION["admin"]);
	}
	/*
	function isUser()
	{
	
		if($_SESSION["webUser"]["use_id"] =='' or  $_SESSION["webUser"]["use_name"] =='' or  $_SESSION["webUser"]["use_email"] =='' )
		{
			header("location:".BASE_WEBURL."/user/login.php?load=login&act=act");
			exit();
		}else{
			//登录后须要处理的事情
			$this -> view -> cache_dir = ROOT_PATH.$GLOBALS['cache_path'].'/'.$_SESSION["webUser"]["use_id"]; ///生成缓存目录
			
			//应该处理权限。一些数组，分类缓存数据等等。
			
			$GLOBALS['Url'] -> loadact();
			
		}
	}
	
	function isLoginUser( $getUrl = '')
	{
		if( ( $_SESSION["webUser"]["use_id"] =='' or  $_SESSION["webUser"]["use_name"] =='' or  $_SESSION["webUser"]["use_email"] =='') and  $getUrl =='')
		{
			header("location:".BASE_WEBURL."/user/login.php?load=login&act=act");
			exit();
			
		}elseif($getUrl == '')
		{
			//登录后须要处理的事情
			$this -> view -> cache_dir = ROOT_PATH.$GLOBALS['cache_path'].'/'.$_SESSION["webUser"]["use_id"]; ///生成缓存目录
			
			//应该处理权限。一些数组，分类缓存数据等等。
			
			$GLOBALS['Url'] -> loadact();
			
		}elseif($getUrl != '' and  ($_SESSION["webUser"]["use_id"] =='' or  $_SESSION["webUser"]["use_name"] =='' or  $_SESSION["webUser"]["use_email"] =='' ))
		{
			header("location:".BASE_WEBURL."/user/login.php?load=login&act=act&".$getUrl);
			exit('ff');
		}
	}
	

	
	function getuserlink()
	{
		if(isset($_SESSION["webUser"]))
		{

			if($_SESSION["webUser"]["use_id"] =='' or  $_SESSION["webUser"]["use_name"] =='' or  $_SESSION["webUser"]["use_email"] =='' )
			{
				$userlink = '<a href="'.BASE_WEBURL.'/user/login.php?load=login&act=reg" target="_self" >'.$_LANG['us_reg'].'</a> | <a href="javascript:loginshow()"  target="_self" onclick="loginshow()" >'.$_LANG['us_login'].'</a>&nbsp;';
				
			}else{
				$this -> view ->assign('webuse_id',		$_SESSION["webUser"]["use_id"]);
				$this -> view ->assign('webuse_name',	$_SESSION["webUser"]["use_name"]);
				$this -> view ->assign('webuse_email',	$_SESSION["webUser"]["use_email"]);
				
				$userlink = $_LANG['us_welcome'].'<a href="'.BASE_WEBURL.'/user/" target="_self" >'.$_SESSION["webUser"]["use_name"].'</a>&nbsp; | <a href="'.BASE_WEBURL.'/user/" target="_self" >'.$_LANG['us_member'].'</a>&nbsp;|  <a href="'.BASE_WEBURL.'/user/login.php?load=login&act=logout" target="_self" >'.$_LANG['us_logout'].'</a> ';
			}
			
			
		}else{
			$userlink = '<a href="'.BASE_WEBURL.'/user/login.php?load=login&act=reg"  target="_self" >'.$_LANG['us_reg'].'</a>| <a href="javascript:loginshow()"  target="_self" onclick="loginshow()" >'.$_LANG['us_login'].'</a>&nbsp;';
		
		}
		
		///您好，admin, 欢迎您回来！ 用户中心 |  退出
		
		return $userlink;
	}
	*/
	
	
}

