[eluser]bhakti.thakkar[/eluser]
hi all,
i am trying to create a check on my applications entry point. if the user tries to access the application without login, then he should be redirect() to login page. I am already using sessions in my application and i was shocked to see that if the user doesnt logout and tries to access the index.php, he is directly able to do it. I tried it with hook, but then it will even check my login page and display error message.
I also have a function in my application/libraries/site_sentry.php and i also have done this is in my autoload.php
$autoload['libraries'] = array('database', 'site_sentry', 'session');
site_sentry.php
Code:
function is_logged_in()
{
if ($this->obj->session) {
//If user has valid session, and such is logged in
if ($this->obj->session->userdata('sname'))
{
return TRUE;
}
else
{
return FALSE;
}
}
else
{
return FALSE;
}
}
but on my applications mainpage, this doesnt get called.
How will i do it. This is my first project with CI
Thanks