Trying out a referrer spam blocking patch

I hacked up a patch to Blosxom to stop refer spam, as it was starting to eat my site. Hopefully I have broken anything in the process..