CodeIgniter Forums
Restricted access in the directory back_end - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Restricted access in the directory back_end (/showthread.php?tid=46721)



Restricted access in the directory back_end - El Forum - 11-13-2011

[eluser]soprabaixar1[/eluser]
The system is divided into front end and back end, and the back end is in the folder called "back_end." For example:

/controllers/back_end/controller_1.php
/model/back_end/Model_1.php
/view/back_end/view_1.php

Access for all model, controllers and views of the directory and subdirectories "back_end" is need to check if the User to be logged.

So I created a librarie and added in the autoload.php and doing just a simple test:


Code:
function __construct()
{        
  $CI =& get_instance();
  
   if (($CI->uri->segment(1) == 'back_end') AND (!$CI->session->userdata('logged_in'))) {
       redirect(base_url().'back_end/login/');
   }
}

But is not working right, anyone know why?