<?php
	if ( ! defined('BASEPATH')) exit('No direct script access allowed');
	
	/**
	* LOGOUT MAIN
	* @author : Zul Zolkaffly
	* @last-update : 08/08/2016 (Zul Zolkaffly)
	*/
	class Logout extends CI_Controller{
		public function index(){
			// LOAD MODEL
			$this->load->model('Usermaster');
			// UPDATE TABLE
			$result = $this->Usermaster->usermaster_edit(array('online'=>0), element('role', $this->session->userdata('logged_in')));
			// DESTROY SESSION
			$this->session->sess_destroy();
			// REDIRECT TO MAIN PAGE
			redirect(base_url(), 'refresh');
		}
	}
?>