ERR_TOO_MANY_REDIRECTS |
Hello,
I use codeigniter 3 and I'm trying to prevent an unregistered user from accessing any function of a controller. To do this in the contructor I check if the session variable "name" is defined and if it is not I do a "redirect" to the base_url(). If this variable is not defined I redirect with "redirect" to the base_url. But what I get is an error: "ERR_TOO_MANY_REDIRECTS". Code: class inicio extends CI_Controller My htaccess is: Code: #<IfModule mod_rewrite.c> Can you hel me? Thanks
That's because the way you are doing it is sending your controller into a never ending loop.
Send them to an error page or something else. IF it is a login auth system then check to see if they are logged in and if not send them to your login page. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(09-16-2018, 09:08 AM)InsiteFX Wrote: That's because the way you are doing it is sending your controller into a never ending loop. Ok. But how i do it? usin "redirect" again? Thanks
It's hard to try and help you when you do not give us the information we need.
What auth system are you using etc; ? What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(09-16-2018, 11:15 AM)InsiteFX Wrote: It's hard to try and help you when you do not give us the information we need. Thanks!!! My sistem is CodeIgniter 3.1.9. i think that if i use "redirect" i nte constructor fo de class i always get de same error. you say me to redirect to a view? like this? Code: class inicio extends CI_Controller
If it is an auth system then you would want them to be sent to a login view.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |