Private functions via ajax - Code Igniter

3

I'm using CodeIgniter to create a web system and so the user does not refresh the page by missing it already I use all ajax calls inside "modules". The problem is that if I put a function in a controller as public the user can kick the URL and access the function without permission and if I use the functions as private, I can not access them through Ajax calls. >

Does anyone have a good solution there?

    
asked by anonymous 05.01.2015 / 16:52

1 answer

3

You can use $this->input->is_ajax_request() of the input class:

if (!$this->input->is_ajax_request()) {
   exit('No direct script access allowed');
}
    
05.01.2015 / 17:31