Welcome Guest, Not a member yet? Register   Sign In
function is_logged
#1

[eluser]Felipe Deitos[/eluser]
Hi!

I got a newbie question...
I have a function that check if user is logged...

I must put this function in every controller?
What it the best practice to do something like this without repeating the same function in every controller.

Thanks for the attention!
#2

[eluser]Unknown[/eluser]
I usually use it like this in every controller that needs authentication.
Code:
<?php
public function admin()
{
     is_logged()
     {
             // admin contents

     }else{
         redirect('login_page');
     }
}
?>
#3

[eluser]Felipe Deitos[/eluser]
Well i am doing like this, putting the is_logged and is_admin in every page..
I just want to know if this is the better way, and if there is other ways to do that

Thanks for the answer!
Cheers!




Theme © iAndrew 2016 - Forum software by © MyBB