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

class Logout extends CI_Controller {

	function __construct() {
        parent::__construct();
		
		$this->load->model('member_model');
    }
	
	public function index()
	{
		if($this->session->userdata('user_type')) {
			$this->db->trans_start();
			$this->member_model->insert_member_log($this->session->userdata('member_id'), LOG_LOGOUT);
			$this->db->trans_complete();
			
			if ($this->db->trans_status() === TRUE) {
				$this->session->unset_userdata(array('member_id' => '', 'member_name' => '', 'member_country' => '', 'member_username' => '', 'member_package_type' => '', 'member_member_type' => '', 'member_allowed_withdraw' => '', 'member_unlimited_withdraw' => '', 'member_allowed_transfer' => '', 'member_allowed_convert' => '', 'member_allowed_topup' => '', 'member_active' => '', 'member_platform_type' => '', 'member_is_claim_only' => '', 'member_login_datetime' => '', 'user_type' => '', 'network_list' => '', 'read_notice' => '', 'search_from_date' => '', 'search_to_date' => ''));
				
				redirect('', 'refresh');
			}
			else {
				redirect('error/', 'refresh');
			}
		}
		else {
			redirect('', 'refresh');
		}	
	}
}

/* End of file logout.php */
/* Location: ./application/controllers/logout.php */