• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
redirect question

#1
[eluser]Unknown[/eluser]
Hello

My questions deals with code execution when calling redirect.

for example in a controller
Code:
function __construct()
{
    some code
    some more code
    redirect(valid args)
    code after redirect
}

does 'code after redirect' get executed?
does the controller action that was called get executed?

This is in relation to blocking access to certain controllers or actions based on whether or not a user is logged in, if they are not I want to prevent the actions from executing and redirect them to the login.

If this is not the proper way to accomplish this, can some one please guide me in the right direction.

Any help would be greatly appreciated.

Thanks
Sam

#2
[eluser]richthegeek[/eluser]
why don't you try it and find out?

for per-load authentication, you may want to investigate hooks.

#3
[eluser]Grahack[/eluser]
Hi dpdev, and welcome to CI.
I quite agree with php_penguin: testing by ourselves is the best way to know. You could even look in the url_helper what exactly this function does. That's REALLY interesting to know the internals of our framework.
My answer is: this can be a proper way, but hooks will catch things faster, preventing the framework to load useless libs.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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