[eluser]RogerM[/eluser]
Hey everyone,
I wrote an Auth library and I have a restrict function based on levels.
if the user isn't logged in or doesn't have access to a page, it will load a default view and be done.
It works, but if I use the restrict function and it won't allow them to access the controller, I get the error view and then the controller view below it.
Any thoughts? Thanks
controller is setup like:
Code:
function index()
{
$this->auth->restrict(5);
$this->load->view('account_main');
}
library restrict function
Code:
function restrict($level)
{
if($level !==NULL)
{
if($this->CI->session->userdata('logged_in') == TRUE)
{
if($this->CI->session->userdata('level') >= $level)
{
return TRUE;
}
else
{
$this->CI->load->view('access_denied');
}
}
else
{
$this->CI->load->view('not_logged_in');
}
}
else
{
$this->CI->load->view('access_denied');
}