<?php

class commonAction extends Action{

	function _initialize(){

		if(!$_SESSION["isLoginH"]) {
			$this->logout();
			$this->display("admin/user/login.html");
			exit;
		}else{
			$umodel=new userModel();

			$user=$umodel->find($_SESSION["uid"]);

			if($user["disable"]){
				$this->logout();
				$this->showMsg("用户被禁止","admin.php");
				$this->assign("className", "login-msg");
				$this->display("admin/user/login.html");
			}elseif(!$user["allow_dlht"]){
				$this->display("admin/user/login.html");
				$this->showMsg("你没有后台的登录权限");

			}

		}
	}

	function logout() {
		$_SESSION = array();
		if (isset($_COOKIE[session_name()])) {
   			setcookie(session_name(), '', time()-42000, '/');
		}
		session_destroy();
		if($_GET["redirect"]){
			$this->showMsg("你己成功退出","admin.php?m=index&a=index");
		}

	}



}
?>