Dodinas Dodinas - 1 month ago 7
PHP Question

Possible for Google Bot to Execute PHP Script

I have a CRON job php script that I just set up not too long ago. However, I noticed that the PHP file executed (without the cron job activating). It appears that it happened when a Google Bot crawled the file, because I noticed that the following engine visited my page:

http://www.google.com/bot.html

My question is:

1) Is it possible, that by crawling my webpage, it could have executed the script?

2) How can I "hide" the CRON file from Google?

3) Would it be smart to place this file in somewhere other than my public_html directory?

Many thanks!

Answer

1) of course it is

2) see robots.txt (http://www.searchtools.com/robots/robots-txt.html)

3) yes. but if for some reason you depend on calling it via a http daemon you can use a little trick.

eg. first line of code:

if(!isset($_GET['execute'])
 exit;

in your crontab:

http://server.tld/file.php?execute=1