I did it but it does not work,
I wanted to block page access without an active session; when I close the tab and I retype the link he must have already killed the session to open the login page
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class MY_Controller extends CI_Controller {
public function __construct() {
parent::__construct();
//For example I have set logged_in = true in authentication on success
//Checking whether userdata logged_in not set ... if true redirecting to login screen
if (!isset($this->session->userdata['logged_in'])) {
redirect(site_url('login'));
}
}
}