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

class Logout extends CI_Controller {

	function __construct() {
		error_reporting(0);
		parent::__construct();
        $this->load->model('CommonModel');
	}

	
	public function index()
	{
		if(check_login()){
			$audit_trail_table='audit_trail';
	        $audit_trail_array=array(
	                                    'user_name'=>$this->session->userdata('admin_name'),
	                                    'action'=>'Action -> "Log out"',
	                                    'action_time'=>date('Y-m-d H:i:s')
	                                );
	        $this->CommonModel->insert($audit_trail_table,$audit_trail_array);
			session_destroy();
			redirect(base_url('Login'));
			
		}
		
		
	}
	public function account_change()
	{
		if(check_login()){
			$audit_trail_table='audit_trail';
	        $audit_trail_array=array(
	                                    'user_name'=>$this->session->userdata('admin_name'),
	                                    'action'=>'Action -> "Account Change To HM"',
	                                    'action_time'=>date('Y-m-d H:i:s')
	                                );
	        $this->CommonModel->insert($audit_trail_table,$audit_trail_array);
			session_destroy();
			redirect(base_url('hotel-manish/Login/account_login/1'));
			
		}
		
		
	}

	public function LogoutStudent()
	{
		$audit_trail_table='audit_trail';
        $audit_trail_array=array(
                                    'user_name'=>$this->session->userdata('admin_name'),
                                    'action'=>'Action -> "Log out"',
                                    'action_time'=>date('Y-m-d H:i:s')
                                );
        $this->CommonModel->insert($audit_trail_table,$audit_trail_array);
		session_destroy();
		redirect(base_url('StudentLogin'));
	}
}