<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*	
 *	Author 	: Daswan
 *	Tanggal : 25-02-2016	
 *	Revisi 	: 
 */

class MY_Controller extends CI_Controller {

	public function __construct(){
        parent::__construct();
        // set_error_handler(array(&$this, 'exception_error_handler'));
        $this->load->model('login/m_login');
    	if ($this->session->userdata("login") == TRUE) {
    		$is_login = $this->m_login->get_session_id($this->session->userdata('session_id'),$this->session->userdata('username'));
	        if($is_login == false){
	        	$username       = $this->session->userdata('username');
	            $session_id     = $this->session->userdata('session_id');
	            $this->m_login->delete_session($username,$session_id);
	            $this->session->sess_destroy();
	            $data['branch'] = $this->m_login->get_branch();
	            redirect(base_url() . 'login', 'refresh');
	     
	        }
        }else{
        	redirect(base_url() . 'login', 'refresh');
        }
	}
}