Created
March 28, 2018 23:59
-
-
Save Bujhm/65ec8f0ba09c7566c4b6c290d376bf9d to your computer and use it in GitHub Desktop.
detect ajax
This file contains hidden or 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
<?php // got from here https://www.sanwebe.com/2011/02/how-to-detect-ajax-request-using-php | |
//detect ajax | |
if(!isset($_SERVER['HTTP_X_REQUESTED_WITH']) AND strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') { | |
die('Request must come from Ajax!'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment