Private functions via ajax - Code Igniter

Asked

Viewed 121 times

3

I am using Code Igniter to create a web system and so that the user does not update the losing page that is already open I use all calls via ajax within "modules". The problem is that if I put a function on 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 cannot access them through calls in Ajax.

Someone out there has a good solution?

1 answer

3


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

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.