title: How to restrict users to go to login page in codeigniter
body: <p>I am new to php and codeigniter. I do not know how to restrict the user to go back to the login page once after successful log in process. I have created sessions also. 
      My sessions are created in model in the following way</p>
  
  <pre><code>$newdata = array(
                  'id' =&gt; $query['entity_id'],
                  'name' =&gt; $query['entity_name'],
                  'uname' =&gt; $query['entity_uname']);
                  $this-&gt;session-&gt;set_userdata($newdata);     }
  </code></pre>
  
  <p>I have heard of is_logged_in in ci, but i donot know how to implement/check using it in ci.
  Any one can help me with your updated code.</p>
  
  <p>My Login controller is as follows:</p>
  
  <pre><code>&lt;?php
  defined('BASEPATH') OR exit('No direct script access allowed');
  
  class Login extends MY_Controller {
  public function index()
  {
  $this-&gt;load-&gt;view('dashboard');
  }
  } ?&gt;
  </code></pre>
  
  <p>And it comes here, after the model page where my session is been established</p>