<?php
// core ctrler
ini_set("display_errors", true);

class User_index extends CI_Controller{
	public $user;
	
	public function __construct()
	{
		parent::__construct();

		//session_start();// for kcfinder

		$this->user = $this->session->userdata('login_state'); //session data storing
		
		//var_dump($this->user);return;
		$m = $this->router->fetch_method();   			//method retrive
		
		if(!isset($this->user['l_id'])){		// not login
			$_SESSION['login'] = false;// for kcfinder
			if(($m!='login') && ($m!='submit'))
				return $this->signin();
		}
		else if(isset($this->user['l_id'])) { 	//is log
			$_SESSION['login'] = true; // for kcfinder
			if(($m=='login') || ($m=='submit')){
				redirect("login_ctrl/index");
			}
		}
	}

	function signin(){
		redirect("login_ctrl/login");
	}
	





	
}

class Admin_index extends CI_Controller{
	public $user;
	
	public function __construct()
	{
		parent::__construct();

		//session_start();// for kcfinder

		$this->user = $this->session->userdata('login_state'); //session data storing
		
		//var_dump($this->user);return;
		$m = $this->router->fetch_method();   			//method retrive
		
		if(!isset($this->user['l_id'])){		// not login
			$_SESSION['login'] = false;// for kcfinder
			if(($m!='login') && ($m!='submit'))
				return $this->signin();
		}
		else if(isset($this->user['l_id'])) { 	//is log
			$_SESSION['login'] = true; // for kcfinder
			if(($m=='login') || ($m=='submit')){
				redirect("admin_login_ctrl/index");
			}
		}
	}

	function signin(){
		redirect("admin_login_ctrl/login");
	}
	





	
}


class User_icd_index extends CI_Controller{
	public $user;
	
	public function __construct()
	{
		parent::__construct();

		//session_start();// for kcfinder

		$this->user = $this->session->userdata('login_state'); //session data storing
		
		// var_dump($this->user);return;
		$m = $this->router->fetch_method();   			//method retrive
		
		if(!isset($this->user['l_id'])){		// not login
			$_SESSION['login'] = false;// for kcfinder
			if(($m!='login') && ($m!='submit'))
				return $this->icd_signin();
		}
		else if(isset($this->user['l_id'])) { 	//is log
			$_SESSION['login'] = true; // for kcfinder
			if(($m=='login') || ($m=='submit')){
				redirect("icd/icd_login_ctrl/index");
			}
		}
	}

	function icd_signin(){
		// var_dump('aa');return;
		redirect("icd/icd_login_ctrl/login");
	}
	





	
}



?>