views:

191

answers:

2

Hello,

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!

+2  A: 

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

Rufinus
+1  A: 

1) If the file is placed in a public web directory, then yes, it could be executed by Googlebot (or any other visitor)

2) You could add a Disallow clause for it in your robots.txt. Any regular user can still go and execute it by visiting if you do this.

3) Yes.

Sebastian P.