[hns-users:65] Re: patch to board.cgi (Re: board.cgi に spam (コメントスパム)

Back to archive index

Kenji kenji****@club*****
2006年 7月 5日 (水) 11:42:37 JST


Kenji です。


On Fri, 26 May 2006 11:13:55 +0900
藤原 誠/ Makoto Fujiwara <makot****@ki*****> wrote:

> >                                           千葉市中央区長洲
> >                                                    藤原 誠
> たびたび済みません。

設定ファイルを /conf/spam_list.txt に変更して、cvs に commit いたします。

Index: board.cgi.in
===================================================================
RCS file: /cvsroot/h14m/hns-perl/public_html/diary/board.cgi.in,v
retrieving revision 1.13
diff -u -r1.13 board.cgi.in
--- board.cgi.in        28 Dec 2002 09:03:49 -0000      1.13
+++ board.cgi.in        5 Jul 2006 02:39:44 -0000
@@ -399,6 +399,22 @@
     die 'invalid diary' if ($diary && (!($diary =~ /^[0-9]+$/) || length($diary) > 30));
     die 'invalid refid' if ($refid && (!($refid =~ /^[0-9]+$/) || length($refid) > 10));

+    my @dirty_words = '';
+    my $spam_list = $HNS::System::DiaryDir . '/conf/spam_list.txt';
+    my @spam_found = ();
+    if ( -f $spam_list & -r $spam_list ) {
+       open(SPAM, $spam_list) || die 'file not found:$!' ;
+       @dirty_words = <SPAM>;
+       close(SPAM);
+       foreach my $word (@dirty_words) {
+           chomp($word);
+           push(@spam_found, grep (/$word/, $body)) ;
+           push(@spam_found, grep (/$word/, $subject)) ;
+           push(@spam_found, grep (/$word/, $site)) ;
+       }
+    };
+    die 'prohibited' if (@spam_found);
+
     foreach ($name, $email, $site) {
        die 'included invalid characters' if /\|/;
     }


> --- board-spam.cgi	2005-12-20 18:42:26.000000000 +0900
> +++ board.cgi	2006-05-26 11:09:09.000000000 +0900
> @@ -399,6 +399,22 @@
>      die 'invalid diary' if ($diary && (!($diary =~ /^[0-9]+$/) || length($diary) > 30));
>      die 'invalid refid' if ($refid && (!($refid =~ /^[0-9]+$/) || length($refid) > 10));
>  
> +    my @dirty_words = '';
> +    my $spam_list = $HNS::System::DiaryDir . '/spam_list';
> +    my @spam_found = ();
> +    if ( -f $spam_list & -r $spam_list ) {
> +	open(SPAM, $spam_list) || die 'file not found:$!' ;
> +	@dirty_words = <SPAM>;
> +	close(SPAM);
> +	foreach my $word (@dirty_words) {
> +	    chomp($word);
> +	    push(@spam_found, grep (/$word/, $body)) ;
> +	    push(@spam_found, grep (/$word/, $subject)) ;
> +	    push(@spam_found, grep (/$word/, $site)) ;
> +	}
> +    };
> +    die 'prohibited' if (@spam_found);
> +
>      foreach ($name, $email, $site) {
>  	die 'included invalid characters' if /\|/;
>      }
> 
> ---
> (藤原)
> _______________________________________________
> H14m-hns-users mailing list
> H14m-****@lists*****
> http://lists.sourceforge.jp/mailman/listinfo/h14m-hns-users
> 



H14m-hns-users メーリングリストの案内
Back to archive index