• I’ve got blacklist running, and I’ve got moderation set on key words. The major spam problem now is when someone breaks through (with a new site, not yet blacklisted) and, before they’re noticed, they’ve deposited 150 comments. Of course that can be cleaned up, but it’s happened enough that I decided to try my hand at setting up a way to stop anyone from commenting with the same URL more than 10 times in a 24-hour period.
    This is what I did:

    // Further flood-protection
    $lastten = $wpdb->get_var(“SELECT comment_date FROM $tablecomments WHERE comment_author_url = ‘$url’ ORDER BY comment_date DESC LIMIT 10,1”);
    if (!empty($lastten)) {
    $date_lastten= mysql2date(‘U’, $lastten);
    $date_newcomment= mysql2date(‘U’, $now);
    if (($date_newcomment – $date_lastten) < 86400)
    $approved = 0;
    }

    I think it’s coded right. It definitely stops me from posting with the same URL more than 10 times in a row, immediately. (I tried that). I don’t think it will block any legit comments. (Right?). And it will mean that I don’t have to mass-delete 145 comments at a time anymore.
    For all I know, someone else already thought of this, but if not, here it is.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter kaimipono

    (@kaimipono)

    Oh, I put that into wp-comments-post.php right before the blacklist section.

    Thread Starter kaimipono

    (@kaimipono)

    I just made a quick change, because I think as written it would inadvertently block people with no url.
    So I added, before this
    if($url) {
    and a
    }
    afterwards.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘A bit of anti-spam flood protection’ is closed to new replies.