Bad bots and bad sites steal bandwith, courrupt your log files and in the worst case, your site may crash. There are verious methods to prevent referrer spam and block bad bots:

1. Robots exclusion.

http://www.robotstxt.org/wc/exclusion.html

Example:
http://multifinanceit.com/robots.txt

2. Use .htaccess.

Examples:
http://multifinanceit.com/htaccess.txt

http://multifinanceit.com/htaccess1.txt

3. Set a spider trap.

http://techpatterns.com/downloads/spider_blocking.php

http://danzcontrib2.free.fr/en/pieges.php#bloquer

"Setting a Spider-trap
The best method of identifying bad bots is to create what is known as a Spider-trap. Create a directory, block that directory to all agents using robots.txt and link to the directory from a page (usually as a small 1x1 pixel link).

Only bad bots will access that directory (ie they've ignored our robots.txt exclusion). These bots can then be directed to a script that will immediately grab their IP address, User Agent or Referrer and add it to an .htaccess file - so that they're banned from the site".

4. Related links.

Block referrer spam

http://www.ilovejackdaniels.com/apac...referrer-spam/

IP Addresses of Search Engine Spiders

http://www.iplists.com/

SpiderTrack.org

http://www.spidertrack.org/index.php

Prevent hijacking:

http://www.loriswebs.com/hijacking_web_pages.html

link where you can download files.

http://www.garykeith.com/browsers/downloads.asp

Why reinvent the wheel?