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

class Base extends CI_Controller {  
     public function __construct() {
        parent::__construct();  
        date_default_timezone_set('Asia/Kolkata');
         $this->load->database();
         $this->load->model('Login_model');
         
//           $ip = $this->input->ip_address();

// $sql = "SELECT ip_adr FROM  allowed_ip where status = '0' and  ip_adr = '$ip' ";	
	
//         $rs = $this->Login_model->Execute($sql, array())->result_array();


//         if(empty($rs)){
            
//             echo '<div style= "text-align:center;background-color:red;color:white; margin-top:30px;"><h1>Your are not allowed to access this website.Please Contact Administration.</h1></div>';
            
            
//             die;
//         }
        
              
    }
    

public function errorpage(){
    $this->load->view('errorpage');
} 

public function index(){
  $this->load->view('login');
        
}

public function login(){
    $this->load->view('login');
        
}




public function dashboard(){
         if ($this->session->userdata('user_login_id') == "" ) {
          redirect('Base/login/');
        } else {
    $user_id = $this->session->userdata('user_login_id');
    $this->load->view('header');
    $this->load->view('dashboard');
    $this->load->view('footer');
        }
}



   function logout() {
        $this->session->sess_destroy();
        $this->session->set_flashdata('msg',' Log Out Successful...!' );	
        redirect('Base');
    }






}
