Trying to make a login session hook in codeigniter
<p>I have this in hook.php:</p>

<pre><code>$hook['post_controller_constructor'][] = array(
    'class'    =&gt; 'Account',
    'function' =&gt; 'check_user_login',
    'filename' =&gt; 'authenticate.php',
    'filepath' =&gt; 'hooks/authenticate',
    'params'   =&gt; array()
    );
</code></pre>

<p>and this in hooks folder authenticate.php:</p>

<pre><code>&lt;?php
class Account
{
    function check_user_login()
    {
        if($this-&gt;session-&gt;userdata('is_logged_in')){
            redirect('pag/index');    
        }else{
            redirect('main/restricted');
        }
    }
}
?&gt;
</code></pre>

<p>I want to make the login session available for all the models/controlers, but something is not right, I also did set the $config['enable_hooks'] = TRUE; thanks</p>