Welcome Guest, Not a member yet? Register   Sign In
Question on auth check with simplelogin
#1

[eluser]San2k[/eluser]
Hi!
Didn't find an answer on forums (maybe i looked bad Wink)

I have a problem with checking if user is logged in. So i'am doing this:
Code:
class MyPROG extends Controller {


        function MyPROG ()
    {
        parent::Controller();
             $user_table = 'users';
         $this->load->helper(array('form', 'url'));

         if(!$this->session->userdata('logged_in')){
         $this->load->view('header');
         $this->load->view('login');
        }
    }

It checks correctly, but the problem is - that if user is NOT logged,
$this->load->view('header');
$this->load->view('login');
- this two view files will be loaded + my Index function will be loaded too.

Code:
function index()
    {
     $this->load->view('header');
     $this->load->view('add_employer');

    }

if i put exit; after $this->load->view('login'); in main function - nothing loads at all.

My main idea, why i did it that way - is that MyPROG runs before any function in controller(is that right?) - so its the best place to check login. so noone can access any functions bypassing login check.

Thanks.


Messages In This Thread
Question on auth check with simplelogin - by El Forum - 09-10-2008, 12:42 AM
Question on auth check with simplelogin - by El Forum - 09-11-2008, 03:43 AM
Question on auth check with simplelogin - by El Forum - 09-11-2008, 05:53 AM
Question on auth check with simplelogin - by El Forum - 09-11-2008, 06:10 AM
Question on auth check with simplelogin - by El Forum - 09-11-2008, 06:13 AM
Question on auth check with simplelogin - by El Forum - 09-11-2008, 06:14 AM
Question on auth check with simplelogin - by El Forum - 09-11-2008, 06:41 AM
Question on auth check with simplelogin - by El Forum - 09-11-2008, 06:43 AM
Question on auth check with simplelogin - by El Forum - 09-11-2008, 08:15 AM
Question on auth check with simplelogin - by El Forum - 09-11-2008, 08:17 AM
Question on auth check with simplelogin - by El Forum - 09-11-2008, 09:42 AM
Question on auth check with simplelogin - by El Forum - 09-11-2008, 10:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB