Hi, I’m trying to check if users has logged in in my site and if not then redirect it to login page but I need this across all the function in my controllers. I don’t want to repeat the code so I think in this:
function __construct() {
parent::__construct();
if(!$this->session->userdata('session_id')) {
$this->session->set_flashdata("no_logged_in", "No tiene permisos para acceder a esta página, por favor " . anchor(site_url() , 'inicie sesión'));
}
}
But it’s not working because users still able to access for example /users/search when this should not be possible until them signin. Any help?
Cheers
