[lists] [wp-hackers] Duplicate Comments/Pings

Mark Jaquith mark.wordpress at txfx.net
Fri Nov 19 13:28:17 UTC 2004


Hm, the only possible problem I see with that is that it isn't specified 
per entry... but all that means is that a user can't submit the same 
comment twice in a row (on the same entry, or on different entries).

Other than that, that code should fix the problem for comments.

Now, for Trackbacks.

in wp-trackback.php, right after this:

>  97      $comment_type <cid:part1.08040708.00080508 at txfx.net> = 'trackback';
>  98  
>  
>
this:

> $duplicate = $wpdb->get_var("SELECT COUNT(*) from $wpdb->comments 
> WHERE comment_content = '$comment_content' AND comment_post_ID = 
> '$comment_post_ID' AND comment_author_url = '$comment_author_url' 
> LIMIT 1;");
> if ( $duplicate ) trackback_response(1, 'You have already sent that 
> Trackback to this entry.');

I believe duplicate pingbacks are already taken care of.


Owen Winkler wrote:

> 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. 

-------------- next part --------------
Skipped content of type multipart/related


More information about the hackers mailing list