im trying to create a new lib which will auto load each time a controller is loaded and authenticate to see if a user is logged in
I’m auto loading the script and its loading fine how-ever it doesn’t seam to authenticate
My Lib
class Authentication {
var $CI;
function Authenication() {
$this->CI =& get_instance();
$this->CI->load->library('session');
$is_logged_in = $this->CI->session->userdata('is_logged_in');
if(!isset($is_logged_in) || $is_logged_in != true)
{
echo 'You don\'t have permission to access this page. <a href="../login">Login</a>';
die();
}
}
}
Any suggestions are greatly appreciated