chat-filter.pl

来自「java开发的聊天室」· PL 代码 · 共 26 行

PL
26
字号
############################################
#脏话过滤
sub filter {
$mypara=$_[0];

 $badword_found = 0;
#  @badwords=('sex','xxx','fuck','shit','TMD','他妈的','她妈的','你妈的','操死你','日死你');
   # Fetch the list of CDA bad words
   open(BADWORDS,"$filehead$badwords_file");
   @badwords = <BADWORDS>;
   close(BADWORDS);
   foreach $badword (@badwords) {
      # Strip any extra CR/LF's
      $badword =~ s/\n//g;
      $badword =~ s/\r//g;
      if ($mypara =~ /$badword/i){
         $badword_found = 1;
         last;
      }
   }
   if ($badword_found == 1) {
		require "$chathead/chat-error.pl";
      &error(bad_words);
   }
}
1;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?