[eluser]the_unforgiven[/eluser]
Hi Guys,
I've 95% built this site i'm doing, but one small problem....
If i login as a customer i can access /admin and vice versa. Obviously I dont want this to happen has it would like signing my own death warrant! So is there a way this can in the construct method for the whole admin controller or do i have to do something like:
Code:
public function dashboard()
{
if ($this->session->userdata('is_admin') == TRUE && $this->session->userdata('is_logged_in') == TRUE) {
//rest of code for the controller
}
else {
redirect('access/denied','refresh');
}
}
For each function? I hope I dont have to do the example for each function surely there's something simpler and can be done in the construct method:
Code:
public function __construct()
{
parent::__construct();
// hopefully something can go in here to say if not logged in and not admin the nothing on this controller gets shown and the user gets redirected somewhere else 404 maybe?
}
So any advice would be greatly appreciated.
Thanks in advance.