• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My_Controller issue

#1
[eluser]ericsodt[/eluser]
So I am doing some filtering at the controller level. I am making sure that a regular user stays within the regular user section and the admins stay within the admin section.

To do this, I extended the Controller and built some logic around it
Code:
function validate(){        
    $inAdminSection = $this->uri->segment(1) == 'admin'?true:false;
    
    if(!$this->session->userdata("isAdmin")&& $inAdminSection ){
        redirect('profile/adminLogin');
        
    }
    if($this->session->userdata("isAdmin") && !$inAdminSection && $loggingOut){
        redirect('admin/admin/index');
    }        
        
    return;
}

Everything works fine except when I try and log an admin out. It sees that it is not in the admin section and is an admin, which then throws them back to where they were.

I am just trying to pass any values to the Controller that would have been passed to the calling method. For example, to log out the url is "welcome/index". This checks to see if the user is logging out and if so completes this action. This method however will never get called because of My_Controller. I was thinking of passing a variable through it as so "welcome/index/logout" but I am having a hard time figuring out how My_Controller can see the parameter.

Does anyone know how a Controller can capture what is being passed to the desired method?


Thanks!


Messages In This Thread
My_Controller issue - by El Forum - 09-09-2009, 01:39 PM
My_Controller issue - by El Forum - 09-09-2009, 02:17 PM
My_Controller issue - by El Forum - 09-09-2009, 02:19 PM
My_Controller issue - by El Forum - 09-09-2009, 02:22 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.