title: codeigniter checking session in all controller error
body: <p>using the below code i used to check whether the user is logged in or not</p>
  
  <pre><code>if(!$this-&gt;session-&gt;userdata['logged_in'])
      {
  
      redirect("gt_login");
      }
      else
      {
  
      }
  </code></pre>
  
  <p>but this code is only working in localhost while i put this into server it shows error like this
  <a href="https://i.stack.imgur.com/S3XJO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/S3XJO.jpg" alt="error"></a></p>
  
  <p>this is where i load session library</p>
  
  <pre><code>function __construct() { parent::__construct(); $this-&gt;load-&gt;library('session'); $this-&gt;load-&gt;database(); $this-&gt;load-&gt;helper('url'); $this-&gt;load-&gt;helper('form'); $this-&gt;load-&gt;model('gt_home_content_model'); if(!$this-&gt;session-&gt;userdata['logged_in']) { redirect("gt_login"); } else { } }
  </code></pre>
  
  <p>i am not much familiar to codeigniter and also is there any other method to do this can any one suggest me to do that ....</p>