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

Back to archive index

藤原 誠/ Makoto Fujiwara makot****@ki*****
2006年 5月 26日 (金) 11:13:55 JST


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

--- 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 メーリングリストの案内
Back to archive index