[lists] [wp-hackers] Duplicate Comments/Pings
Owen Winkler
ringmaster at midnightcircus.com
Fri Nov 19 12:59:47 UTC 2004
Mark Jaquith wrote:
> I'm talking about discarding the current ping or comment if it is an
> exact duplicate of a previous ping or comment for the same entry
> only! And by duplicate, I mean duplicate. Same IP, same content,
> same everything. You could also set a time limit (say, within 10
> minutes), but that's not really necessary.
>
> Example: (don't quote me, this isn't necessarily the exact code that
> would be used)
Or, change the existing flood query to something like:
$lasttime = $wpdb->get_row("SELECT comment_date, comment_content FROM
$wpdb->comments WHERE comment_author_IP = '$user_ip' ORDER BY
comment_date DESC LIMIT 1");
And then add the check:
if ($lasttime->comment_content == $comment)
die( __('Sorry, you have already posted that comment.') );
Doing this wouldn't add an additional query to the comment routine.
Owen
More information about the hackers
mailing list