I use ajax to get the value from php scripts (e.g. cost.php), and I know that it would be easy to access it directly and get that value. I even do cron work on the same script (cost.php), so the cron job will not work if I use the following ...
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
die('Invalid Request!');
}
This is a safe way to prevent, and cron jobs will not work if I use the code above so that I can use to provide value from the end user. thank.
source
share