Actually I want to apply a check to run my cron only from my server, as it is a cron file and run through command it doesn't give any IP address. So i can't apply ip check here.
I just applied check right now that if I get blank IP, means file run through command(scheduled cron) at server. I know it is not safe.
Please give me your suggestion.
A common method can be found in the Joomla /cli
files, which check for the existence of the key REQUEST_METHOD
in the global $_SERVER
.
// Make sure we're being called from the command line, not a web interface
if (array_key_exists('REQUEST_METHOD', $_SERVER)) die();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.