I try to find out if a request to a PHP file is sent by ajax or not.
I googled it and read a whole a bunch of articles that suggest following method:
There's no 100% way to detect if the request was made via ajax. Even if someone sends header with "X-Requested-With: XMLHttpRequest" you shouldn't rely on it.