Welcome Guest, Not a member yet? Register   Sign In
Hook from redirect to page


I need that when I load the system I verify a session "paid" if it exists and its value is greater than zero, so that the system continues normal, but if the system does not exist or is zero, then it automatically redirects a controller and a method to force the user to assign the session "paid".

 if ($this->CI->session->userdata('rolid')) { 
// echo $this->perms[$this->role_field][$class][$method]; exit(); 
if (!isset($this->perms[$this->CI->session->userdata('rolid')][$class][$method])){ 
// echo 'entre aqui'; exit(); 
            }else if (
$this->perms[$this->CI->session->userdata('rolid')][$class][$method]) { 

// redirect('welcome','location'); 
} else { 

        } else { 
// print_r($class).'<br>'.print_r($method); exit(); 
if(strtolower($class) == 'login' || strtolower($class) == 'admin'){ 

That code is part of an ACL in a hook post_controller_construtor where I try to redirect with redirect('admin/index', 'location'); but the browser gets me an error, of "too many requests".

Any help or advice would be appreciated.

Make a search in your project after the phrase "too many requests" as that's not something that is included by default in CI 3 (but in CI 4). Maybe it's in any of your included libraries. If not, it's your webhost that are giving you these typ of problem.

I Use CI 3, the massaje is:

Esta página no funciona
localhost te redireccionó demasiadas veces.
Intenta borrar tus cookies.

That's a completely different message. For some reason you are creating a infinite loop of redirects. You need to start removing some code and see where it always returns true (or false) and keeps redirecting the user.
If the problem gets solved by just removing "redirect('admin/index','location');" you are always returning false on "$this->CI->session->userdata('paid')" and you should stop checking for it in admin/index.

Thank jreklund, I resolve problem.

Theme © iAndrew 2016 - Forum software by © MyBB