Support » Plugins » Anti spam using a comment hash

  • This is strictly a proof of concept bit of code. When you attempt to post a comment, a check is made to see if the same comment already exists by calculating the hash of the comment body. This will catch comment flooding by spammers, as well as the accidental hitting of “say it” twice in a row. It will also prevent the “me too” comment. The reason the code is proof-of-concept is because its overhead can be a bit high. It calculates the hash of every single comment each and every time a new comment is posted. A better way of handling this is to compute the hash at posting time and store it in the “comments” table. Place these two lines in wp-comment-post.php just after the block of code for “simple flood protection”:

    $already_posted = $wpdb->get_var("SELECT count(*) FROM $tablecomments WHERE md5("$comment")=md5(comment_content)");
    if (!empty($already_posted) && $already_posted) die( __("This message has already been posted!") );

    This will only prevent multiple spams of the exact same garbage, but the first one will get through.


Viewing 1 replies (of 1 total)
  • Most spamming tools already take note of such protective methods by varying comment content. But it may catch the dumber stuff out there.

Viewing 1 replies (of 1 total)
  • The topic ‘Anti spam using a comment hash’ is closed to new replies.