Welcome Guest, Not a member yet? Register   Sign In
User Authentication
#21

[eluser]Moon 111[/eluser]
That would be a good reason...

Final product:

Code:
<?php

Class MY_Controller Extends Controller {

    public function __construct() {
    
        parent::__construct();
        
        $this->load->helper('url');
    }
}



Abstract Class AuthController Extends MY_Controller {

    public function __construct() {
    
        parent::__construct();
    
        if(!$this->authenticate()) {
        
            redirect('notloggedin');
        }
    }
    
    abstract public function authenticate();
}



Class AuthNoneController Extends AuthController {
    
    public function authenticate() {
    
        return true;
    }
}

Class AuthUserController Extends AuthController {
    
    public function authenticate() {
    
        // Use auth
    }
}

?>

Thanks everyone for your help,
- Moshe
#22

[eluser]felyx[/eluser]
Edited: Never mind me Smile




Theme © iAndrew 2016 - Forum software by © MyBB