[eluser]blasto333[/eluser]
I know this is probably the 3rd or 4th thread discussing this issue, but I have looked at all the previous solutions and have not been able to get security I want for my application.
Goal: To have a base controller to encapsulate security for all other controllers in application. Controllers can simply extend the base controller and it would take care of making sure the user is logged in.
The problem I am having, is redirect never gets called and the output is "I shouldn't get here"
application/libraries/MY_Controller.php
Code:
<?php
class MY_Controller extends Controller
{
function MY_Controller()
{
parent::Controler();
}
}
class Secure_Area extends MY_Controller
{
function Secure_Area($module_id=null)
{
parent::Controller();
$this->load->model('User');
if(!$this->User->is_logged_in())
{
redirect('login');
}
if($module_id!=null)
{
if(!$this->User->has_permission($module_id))
{
die('You do not have permission to access this module');
}
}
}
}
?>
application/controllers/home.php
Code:
<?php
class Home extends Secure_Area
{
function Home()
{
parent::Controller();
}
function index()
{
echo 'I shouldn\'t get here';
}
}
?>