<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Auth
{
   public function __construct(){
		$this->CI =& get_instance();
   }
   
   function auth_main(){		
		if ($this->CI->session->userdata('logged_in')==""){
			redirect(site_url('login'));
		}
	}
	
	function auth_login(){
		if($this->CI->session->userdata('logged_in'))
		{
			redirect(site_url());
		}
	}
	
	//login chech function
	function loggedin()
	{
		if (isset($_SESSION['username']) || isset($_COOKIE['username']))
		{
			$loggedin = TRUE;
			return $loggedin;
		}
	}
}