[eluser]xwero[/eluser]
you can extend the url helper with this function
Code:
function logged_in($redirect='')
{
$CI =& get_instance();
if( ! $CI->session->userdata('logged_in_value'))
{
redirect($redirect);
}
}
In your controllers you only have to add the function with optional redirect segment(s). If you want several methods redirected to one particular method you can add it as a class variable in your controller and then you do
Code:
logged_in($this->first_page);
This function is based on a session variable that is set after a member logs in but you can make different functions with other checks for instance to show pages only to superadmins, editors, ...
It uses the redirect function from the url helper that is why i advised you to add it to the extended url helper file.
It's a very basic way to protect method but you can use it also to protect controllers if you want.