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

class MY_Controller extends CI_Controller
{

    protected $home;

    public function __construct()
    {
        parent::__construct();

        $c = $this->router->fetch_class();
        $m = $this->router->fetch_method();

        if (!$this->session->userdata('isLoggedIn')) {

            $visitor_urls = array(
                'index',
                'admin_login',
                'dashboar1d',
            );

            if (!in_array($m, $visitor_urls)) {
                redirect(base_url());
            }
        }

    }

}
