Forum Moderators: coopster
Could I setup something like this?
if (!strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'Googlebot') &&!strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'slurp@inktomi.com;') &&!strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'ZyBorg') &&!strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'FAST-WebCrawler') &&!strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'Gigabot') &&!strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'Scrubby') &&!strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'msnbot') &&!strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'YahooSeeker'))
If anyone can help that would be great :)
Thanks in advance for your help!
Wes
A good start would be to block the major ones:
Then any that are specific to your region or genre (check your raw logs):
and so on.
A more 'compact' version of your code would use in_array [php.net] and the $_SERVER['HTTP_USER_AGENT'] variable ($HTTP_SERVER_VARS is now deprecated).
Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
Mozilla/5.0 (compatible; Yahoo! Slurp; [help.yahoo.com...]
YahooSeeker/1.2 (compatible; Mozilla 4.0; MSIE 5.5; yahooseeker at yahoo-inc dot com)
The javascript should be like this:
<script type="text/javascript" src="counter.php"></script>
where counter.php is the counter page. The counter.php can output nothing(contain no javascript at all), but you can use counter.php to output the count number through such a line:
echo "document.write('" . $count . "')";
If you're familiar with DOM, you can also rewrite the line above in a DOM compliant form.