Last active
November 2, 2015 08:44
-
-
Save EvilWolf/f80bba8f3165baa34ac2 to your computer and use it in GitHub Desktop.
Проверяет запрос на заголовок HTTP_X_REQUESTED_WITH, тем самым проверяем в PHP пришёл ли запрос через Ajax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* AJAX check */ | |
if(empty($_SERVER['HTTP_X_REQUESTED_WITH']) || strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') { | |
/* У запроса нет параметра HTTP_X_REQUESTED_WITH или он не равен xmlhttprequest */ | |
die('Non-Ajax Request'); | |
} | |
echo 'Ajax Request'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment