sub filter_bad_words_suspect { $bad_words_file = "/bad-words-suspect.txt"; $badword_found = 0; open(BADWORDS,"$bad_words_file") || die "*** Could not open bad wo +rds list.\n"; @badwords = <BADWORDS>; close(BADWORDS); foreach $badword (@badwords) { # Strip any extra CR/LF's $badword =~ s/\n//g; $badword =~ s/\r//g; if (($description =~ /$badword/i) || ($email =~ /$badword/i) +|| ($title =~ /$badword/i) || ($contact =~ /$badword/i) || ($organiza +tion =~ /$badword/i)) { $badword_found = 1; # If a bad word is found, highlight all occurances of it #$contact =~ s/($badword)/<B>$1<\/B>/ig; #$email =~ s/($badword)/<B>$1<\/B>/ig; #$title =~ s/($badword)/<B>$1<\/B>/ig; #$description =~ s/($badword)/<B>$1<\/B>/ig; #$organization =~ s/($badword)/<B>$1<\/B>/ig; } # end if (($name =~ /$badword/i) || ($email =~ /$badword/i). +.. } # end foreach $badword (@badwords) &error2(bad_words) if ($badword_found == 1); return; } # end filter_bad_words subroutine sub error2 { require "all-common.sub" || die "Error loading all-common.sub"; $error = $_[0]; $admin_email = "info\@123.com"; open (MAIL, "|$mailprog $admin_email") || die "Can't open +$mailprog!\n"; print MAIL "From: Test Server <admin@123.com>\n"; print MAIL "To: $admin_email\n"; print MAIL "Subject: Error: Suspect Words\n"; print MAIL "Content-type: text/plain\n"; print MAIL "The spam filter was triggered.\n\n"; print MAIL "Name: $name\n"; print MAIL "Username: $username\n"; print MAIL "Email: $email\n"; print MAIL "IP: $IP\n"; print MAIL "Badword: $badword\n"; close (MAIL); return; }
In reply to Badwords Routine by htmanning
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |