title: how to prevent entering to the site using url typing in codeigniter
body: <p>I have a site using CodeIgniter that is almost complete now.  My problem is that, even though I have implemented sessions and maintain a login system, a person can access any page by typing the URL into the browser address bar.</p>
  
  <p>I have implemented the session for patient registration like this:</p>
  
  <pre><code>function index(){
      $this-&gt;is_logged_in();
  }   
  
  function log_out(){
      $this-&gt;session-&gt;sess_destroy();
      redirect('login_controller');   
  }
  
  function is_logged_in(){
      $is_logged_in = $this-&gt;session-&gt;userdata('is_logged_in');
  
      if(!isset($is_logged_in)||$is_logged_in!= TRUE ){
          redirect('login_controller');
      }else{
          $this-&gt;main();      
      }
  }
  </code></pre>
  
  <p>Anonymous users can't acess the system just by typing the controller name like this:</p>
  
  <blockquote>
    <p><a href="http://localhost/demo_site/index.php/register_controller" rel="nofollow">http://localhost/demo_site/index.php/register_controller</a></p>
  </blockquote>
  
  <p>But they can do it like this:</p>
  
  <blockquote>
    <p><a href="http://localhost/demo_site/index.php/register_controller/search_patient" rel="nofollow">http://localhost/demo_site/index.php/register_controller/search_patient</a></p>
  </blockquote>
  
  <p>Person can't access by typing the controller name, but can enter the system by typing a longer url than the controller, like the one shown above.</p>
  
  <p>What is the problem here? What are the possible solutions??</p>