7/7/2004 ↓

More comment flood

Author: Mark Ghosh Category: WordPress Hack

Thanks for visiting! If you're new here, you may want to subscribe to our RSS feed. This blog posts regular Wordpress news, updates of themes, plugins, ideas, hacks, quick fixes and everything about blogging, especially about Wordpress. Go ahead, subscribe to our feed! You can also receive updates from this blog via email.

Addendum from my previous post about comment flooding, this is what I would change the code in my wp-comments-post.php (between the comments, you should recognize the place):

// Simple flood-protection
$lasttime = $wpdb->get_var("SELECT comment_date FROM $tablecomments ORDER BY comment_date DESC LIMIT 1");
if (!empty($lasttime)) {
$time_lastcomment= mysql2date('U', $lasttime);
$time_newcomment= mysql2date('U', $now);
if (($time_newcomment - $time_lastcomment) < 300)
die( __('Sorry, this blog only allows a new comment once every 300 seconds. If you really want to write a comment, just wait a few and hit refresh on this page. Chances are you tried to add a comment about halfway between 0 and 300 seconds. Comment flooders are annoying. Thank you for being patient.') );
}

My own MySql server is messed up (because my mysql server is screwy AND in a different time zone than my web server, figure that) but it should work. If something breaks, I will try it on another server.

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5 out of 5)
Loading ... Loading ...
Sphere: Related Content | stumbleit |
Translate to German Translate to Spanish Translate to French Translate to Italian Translate to Portuguese Translate to Japanese Translate to Korean Translate to Russian Translate to Chinese

Latest Videos

4 Comments | Leave a comment | Comments RSS

  1. Nice idea Mark, any chance of releasing it as a plugin so users dont have to hack the wp-comments-post.php file directly?

    Neerav (1 comments.) — 10/1/2004 @ 6:43 am
  2. [...] not eliminated the spam completely. I have found another suggestion on Weblog Tools - to increase the minimum time between posts. Wordpress’ default settin [...]

  3. [...] another hack involves increasing the time between comment submissions, a method that works to stop spammers that “flood” your comments, but does nothing to [...]

  4. Thumbs up! I put my vote in for a plugin also, this would be great. Thanks for the wp hack Mark.

    Jason (1 comments.) — 08/30/2007 @ 5:41 am

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

(required)

(required, will not be published)


S2