How do I prevent direct controller function access? |
[eluser]Kraig[/eluser]
I have looked around and a lot of people say to use the underscore before the function or just make it private instead of public. However, if I do this then I cannot access it from my script either. Is there another way to prevent someone from entering this directly into their address bar? www.somesite.com/folder/controller/some_function This is just an example....So far I have come up with an idea, but it seems like a lot of work to do every time: Code: public function some_function() Also how come when I enter "www.somesite.com/folder/controller/" into the address bar I don't get the "No direct script access allowed" error? I have the code below at the top of everyone of my files...minus the views (should I add it to the views?) Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
Welcome Guest, Not a member yet? Register Sign In |