Welcome Guest, Not a member yet? Register   Sign In
Creating a new lib
#1

[eluser]snowstar[/eluser]
Hi all,

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
Code:
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


Messages In This Thread
Creating a new lib - by El Forum - 06-15-2011, 08:33 PM
Creating a new lib - by El Forum - 06-16-2011, 04:15 AM
Creating a new lib - by El Forum - 06-16-2011, 05:33 AM
Creating a new lib - by El Forum - 06-16-2011, 02:47 PM
Creating a new lib - by El Forum - 06-16-2011, 06:42 PM
Creating a new lib - by El Forum - 06-16-2011, 07:39 PM
Creating a new lib - by El Forum - 06-16-2011, 07:57 PM



Theme © iAndrew 2016 - Forum software by © MyBB