PHP/MySQL - an array filter for bots

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2009-07-08T23:50:39Z Indexed on 2011/01/02 19:53 UTC
Read the original article Hit count: 145

Filed under:
|
|
|

Hello,

I'm making a hit counter. I have a database and I store the IP and $_SERVER['HTTP_USER_AGENT']; of the visitors. Now I need to add a filter, so I can put away the hits, that are made by bots. I found out, that many bots usually keep some common words in the $_SERVER['HTTP_USER_AGENT']; , so I's like to make and array of words, that would keep the bot from displaying in the results.

Here is what I have now:

while($row = mysql_fetch_array($yesterday, MYSQL_ASSOC)) {

<-- Here I need a code, that would run through an array and check, if it containts the keywords and if it doesn't ... just count++; -->

	}

Also if you know any other way of detecting and removing the bots from the results, I'd be verry thankful. Cheers

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql