PHP vs. bots

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
ambivalent
Forum Contributor
Posts: 173
Joined: Thu Apr 14, 2005 8:58 pm
Location: Toronto, ON

PHP vs. bots

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
User avatar
ambivalent
Forum Contributor
Posts: 173
Joined: Thu Apr 14, 2005 8:58 pm
Location: Toronto, ON

Post by ambivalent »

Thanks. I was thinking along those lines as well but it's always helpful to get a second opinion.
Post Reply