Hello,

I've been having a problem with a serial comment spammer lately. I've set
the throttle low, removed anonymous posting rights, been deleting messages,
even created a script to just go through and automatically change his posts.
Still the crazy bugger keeps posting long lists of link spam to my site*.

Here is my answer to this. Set up the way comments are printed so that if
too many links are included in one comment they get filtered out. I am
posting to ask if what I am proposing has any problems and is sane. This
idea  requires two new site controls:

remove_many_anchors - A boolean variable. If set then any comment with more
links than specified in the next control gets filtered when it comes time to
print out the comment.

max_anchors_per_comment - The maximum number of links that can appear in a
comment.

Here are the sql comands to create these two new controls:

INSERT INTO `vars` (name,value,description,type,category) VALUES
('remove_many_anchors','0','Set true to remove excessive anchor tags in a
comment.','bool','Comments');

INSERT INTO `vars` (name,value,description,type,category) VALUES
('max_anchors_per_comment','4','The maximum number of anchor tags that can
occur in a comment. If more than this occurs then they are removed if the
remove_many_anchors variable is set.','num','Comments');

The idea is that whole comments are stored in the database and only filtered
when it comes time to print them. That way if you want to make a change
after something is posted the original post is preserved. So this is
independent of the data in the database.


Finally, the following code must be added to Format.pm:

206,220d205
<
<
<         # Check to see if we should check for too many anchors
<       if ($S->{UI}->{VARS}->{remove_many_anchors}) {
<           # We need to check to see if too many anchors are defined.
<           my $de_anchored_comment = $comment_text;
<           my $num_anchors = $de_anchored_comment =~
<                      s/<\s*[Aa]\s+[hH][rR][eE][fF]\s*=\s*".*?"\s*>//g;
<             if ($num_anchors >
$S->{UI}->{VARS}->{max_anchors_per_comment}){
<               $de_anchored_comment =~ s/<\s*\/\s*[aA]\s*>//g;
<               $comment_text = $de_anchored_comment;
<           }
<       }
<
<

I've tested this on a fake site I run for testing purposes. It seems to work
okay in a few limited tests. My question, am I missing something? Is this
worthwhile?

Sincerely,
Kel

* I tracked his ip address down to mainland China and even resorted to
changing his posts to pro-Taiwan rants yet still he keeps posting these
inane sets of links. I wish there were a way to submit an email address to
one place to insure that it gets put on *everybody's* email spam list. But I
digress...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kuro5hin.org/pipermail/scoop-help/attachments/20060507/3ee1588e/attachment.html