BetaCategory: PHP - Owner: PaulDavis - Owner ID: 1
Detects if the file was requested by JS
<?php
define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
if(IS_AJAX) {
// Do stuff
} else {
// Show error
}
?>