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

class MY_Controller extends CI_Controller {
    function __construct(){
        parent::__construct();
        $user = $this->session->userdata('user_id');
        if(!isset($user)){
            redirect(site_url('login'));
        }
    }
}