![]() |
codeigniter No direct script access allowed - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: codeigniter No direct script access allowed (/showthread.php?tid=58701) |
codeigniter No direct script access allowed - El Forum - 07-10-2013 [eluser]Cgull[/eluser] Hello, I am using ci2.1.3 and HMVC I have this folders structure: c:/sites/mysite appclication system public_html I have a controller in appcliation/core/MY_Controller: Code: <?php if(!defined('BASEPATH') OR exit('No direct script access allowed')); Code: <?php if(!defined('BASEPATH') OR exit('No direct script access allowed')); I have this controller in: application/controllers/page Code: <?php if(!defined('BASEPATH') OR exit('No direct script access allowed')); This is my routes file: Code: $route['default_controller'] = "page"; Trying to go to mysite in the browser I get this error: No direct script access allowed Why is that? I thought I should put this line on top of every controller? Code: <?php if(!defined('BASEPATH') OR exit('No direct script access allowed')); Or should I not bother with that as my application and system folders are out of the root folder? Thanks, Sigal codeigniter No direct script access allowed - El Forum - 07-10-2013 [eluser]Ckirk[/eluser] This is the correct code you need at the top Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Your version will always fire off the exit command codeigniter No direct script access allowed - El Forum - 07-10-2013 [eluser]Cgull[/eluser] Ah ! the missing bracket, thank you ![]() |