[wp-hackers] wp-denyhost

Per Søderlind per at soderlind.no
Thu Apr 17 23:23:27 GMT 2008


Hi,

I’ve written a plugin (not ready for release yet) that does the following:

define('PS_DENYHOST_THRESHOLD', 5);
function ps_denyhost() {
  global $wpdb;

  $suspect = $this->get_IP(); 
  $count = (int) $wpdb->get_var("SELECT COUNT(comment_ID) FROM
$wpdb->comments  WHERE comment_approved = 'spam' AND comment_author_IP LIKE
('%$suspect%')");

  if ($count > PS_DENYHOST_THRESHOLD) {
    exit; 
  }   
}
add_action('init', 'ps_denyhost');

The idea is that if a commenter has been tagged as a spammer more than
PS_DENYHOST_THRESHOLD times, he will be blocked.
The reason for PS_DENYHOST_THRESHOLD is to prevent a innocent commenter,
with comments wrongly tags as spam, from being block.

I guess there are similar plugins, but I couldn't find them.

Btw, I use this together with Akismet.

Comments?`

Regards,
PerS





More information about the wp-hackers mailing list