Latest version: “Hidden” Subject field, 2 hour cache window (from current day), optional manual keyword filter.
//config file
// ‘Cache Buster’ extra data to make sure the md5 checksum it generates in the
// comment form is not reverse engineerable. In the installation process, it would auto-fill
// with a rand() echo;
define(‘COMMENTCACHE’, ‘Were gonna need a bigger boat.’);
// This is a word list, comma separated (no spaces), for comments. If one of these words is in a comment,
// it will not be posted.
define(‘FILTER’, ‘tramadol,casino,poker,phentermine,insurance’);
//comment area ( I like to add the style to the beginning of the page, seems less obvious to the human/bot eye )
<style type=”text/css”><!– #subj input, #subj p { display: none; } –></style>
<div id=”subj”><p><label for=”subject”>Subject</label><br /><input type=”text” name=”subject” id=”subject” value=”” size=”22″ /><br /></p></div>
<input type=”hidden” name=”cache” value=”<?php echo md5(date(YmdH).COMMENTCACHE); ?/>” />
// server-side comment logic
if( !$_POST[‘subject’] ) {
if( $_POST[‘cache’] == md5(date(YmdH).COMMENTCACHE) || $_POST[‘cache’] == md5(date(“YmdH”,mktime(date(H)-1, 0, 0, date(m),date(d),date(Y))).COMMENTCACHE) ) {
if(FILTER) {
$filterList = explode(‘,’, FILTER);
foreach($filterList as $badWord) {
if(
stristr($comment_author, $badWord) ||
stristr($comment_author_email, $badWord) ||
stristr($comment_author_url, $badWord) ||
stristr($comment_content, $badWord)
) { $badCount++; }
}
if($badCount == 0) { $comment_id = wp_new_comment( $commentdata ); }
}
}
Ok, is now a WordPress Plugin!