Created
February 4, 2010 15:19
-
-
Save treffynnon/294731 to your computer and use it in GitHub Desktop.
PHP: Detecting a valid request via a pass key set in a header
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
<?php | |
if('my-agent' !== $_SERVER['HTTP_USER_AGENT'] or | |
$_SERVER['SERVER_ADDR'] !== $_SERVER['REMOTE_ADDR'] or | |
!isset($_SERVER['HTTP_TASK_KEY']) or | |
empty($_SERVER['HTTP_TASK_KEY']) or | |
'my-secret-key' !== $_SERVER['HTTP_TASK_KEY']) { | |
print 'You do not have permission to execute this script!'; | |
exit(); | |
} | |
print 'Executing operation.'; | |
//insert your processing script here | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment