Welcome Guest, Not a member yet? Register   Sign In
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




Theme © iAndrew 2016 - Forum software by © MyBB