Comment Spam Solution?
Posted in Tech
Afternoon watch, 7 bells (3:45 pm)

I just ran across WebHashcash, it forces your clients to pay a “postage” (compute a hash value) before they can hit a submit button on a form. This would work well for blogs, bulletin board systems, etc etc. I’ve implemented it here, so please drop by and enter a comment. The system is a combination of javascript and full-on Java and pretty impressive. If you have a problem commenting here, please send me a message.

The site explains everything and has code samples in many different flavors. It’s also extremely simple to integrate into WordPress.

Please Note: If you are maintaining XHTML 1 Strict compatibility (like I am), you should change the document.<formname>.<submit-button> to document.forms[N].<submit-button>, where N is the number of the form. The name attribute of the form element has been deprecated. This will cause problems for you if you add new forms to your page, though. If you know a better way around this (ie using the id attribute instead of the name) please let me know.

14 Dec 2006 Update:
I figured it out all on my own, here is the javascript code to add in to WHCConfig():

var myForm = document.getElementById('commentform');
WHCSubmitButton = myForm.submit; // or your submit button's name
2 Comments »