I disabled trackbacks and added two lines of code and totally cut off my daily stream of comment and trackback spam that sometimes ran into the thousands per day. My emails which are unread which contain the comment/trackback notifications, went from 42,000 to 6000 after I deleted all the spam notifications. I need to run some massive MySQL queries to clear the spam comments out of my blog, but that should be rather simple.
I’d like to share these two homebrew, but very effective, lines of code with you. Basically what it does is ask each blog commenter for my (blog author’s) first name. If they don’t supply it, the comment doesn’t post.
The first was put into the “/skins/_feedback.php” file.
I inserted this:
form_text( 'antispam', $antispam, 40, T_('Anti-Spam'), T_('Enter the first name of this blog\'s author.'), 4, 'bComment' );
right after this line of code:
form_text( 'url', '', 40, T_('Site/Url'), T_('Your URL will be displayed.'), 100, 'bComment' );
and got this:
else
{ // User is not loggued in:
form_text( 'author', $comment_author, 40, T_('Name'), '', 100, 'bComment' );
form_text( 'email', $comment_author_email, 40, T_('Email'), T_('Your email address will not be displayed on this site.’), 100, ‘bComment’ );
form_text( ‘url’, ”, 40, T_(’Site/Url’), T_(’Your URL will be displayed.’), 100, ‘bComment’ );
form_text( ‘antispam’, $antispam, 40, T_(’Anti-Spam’), T_(’Enter the first name of this blog\’s author.’), 40, ‘bComment’ );
}
The second modification was in “/htsrv/comment_post.php”. I added this line:
if( strtolower($antispam) != 'hans' ) errors_add( T_('Please fill in the Anti-Spam field with the first name of the blog author! Sorry, but I had to do this to put a halt to the 30,000+ comment spams I got in a 3 month period.') );
Right after this line:
if( empty($email) ) errors_add( T_('Please fill in the email field') );
And ended up with this:
if ($require_name_email)
{ // Blog wants Name and EMail with comments
if( empty($author) ) errors_add( T_('Please fill in the name field') );
if( empty($email) ) errors_add( T_('Please fill in the email field') );
if( strtolower($antispam) != 'hans' ) errors_add( T_('Please fill in the Anti-Spam field with the first name of the blog author! Sorry, but I had to do this to put a halt to the 30,000+ comment spams I got in a 3 month period.') );
}