Hey SMF!
I want to run my script through cron. Its an addon to an awards plugin, that checks users registration dates and issues time based awards. My script is including SSI.php, however I get this error when the script actually runs in cron:
PHP Notice: Undefined index: REMOTE_ADDR in /home/rgclan/public_html/bb/Sources/ManageSearchEngines.php on line 468
Halp?
Well, it's a bit hackish but just before your custom script loads SSI.php, you can add:
$_SERVER['REMOTE_ADDR'] = '';
Quote from: arrowtotheknee on January 16, 2012, 06:53:18 PM
Well, it's a bit hackish but just before your custom script loads SSI.php, you can add:
$_SERVER['REMOTE_ADDR'] = '';
I don't think you can modify $_SERVER variables.
Oh well, I followed this: http://www.simplemachines.org/community/index.php?topic=329894.0 and got it working
~Solved
Yes, you can modify $_SERVER variables. Once they enter PHP, they're just regular variables in a global scope.
Still, there is an advantage to using cron vs scheduled tasks - cron will always run, while scheduled tasks can only run if the forum is actively loaded during that time (since browsing the forum will trigger the task check/run), mind you if the search engines are viewing your site it usually isn't a problem.