Page 1 of 1

PHP vs. bots

Posted: Sun Aug 21, 2005 10:46 am
by ambivalent
I was poking through my logs last month and noticed a certain recurring visitor, once a month, since December 2004. The requests originated from the IP range 63.148.99.237 - 9, which is owned by a company called Cyveillance (http://www.cyveillance.com). Initially, I thought it was a standard browser because it identified itself as: Mozilla/4.0 (compatible; MSIE 6.0; Windows XP).

With that, I added the following code to index.php to redirect any future requests:

Code: Select all

$who = $_SERVER['REMOTE_ADDR'];
if (($who == "63.148.99.237") || ($who == "63.148.99.238") || ($who == "63.148.99.239")) {
	header("location: http://www.cyveillance.com");
	exit; }
After some further research, it seems that this is a bot and not a normal browser as I first thought. The question is, is the above code still valid with respect to a bot or can it (or others) be made such that it will ignore the redirect? Or would denying it with .htaccess be more effective?

Posted: Sun Aug 21, 2005 10:54 am
by feyd
their bot may not actively follow a location redirect, however because you stop the script immediately afterward, they should only get your headers. Personally, I'd probably make that a .htaccess change though.

Posted: Sun Aug 21, 2005 11:46 am
by ambivalent
Thanks. I was thinking along those lines as well but it's always helpful to get a second opinion.