Skip to content

Instantly share code, notes, and snippets.

@EvilWolf

EvilWolf/check_ajax.php

Last active Nov 2, 2015
Embed
What would you like to do?
Проверяет запрос на заголовок HTTP_X_REQUESTED_WITH, тем самым проверяем в PHP пришёл ли запрос через Ajax
/* 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
You can’t perform that action at this time.