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

#1
[eluser]druid100[/eluser]
hi,

to protect certain functions within my controllers i check within my auth library if the user is logged in. if he is not logged in i redirect him to the login page. however i noticed that after redirect() the program flow continues.

so i seed two choices:

1) write the controller function like this:

function my()
{
if ( !$this->auth->noGuestAccess() )
return;
}

2) write the noGuestAccess() function like

function noGuestAccess()
{

.
.
.

redirect('');
exit();

}

what style would you prefer? exit() is quite harsh ... Big Grin

#2
[eluser]druid100[/eluser]
... ok forget about my post. redirect() discontinues the program flow as i noticed once i started logging correctly. Smile


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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