Name: Anonymous 2009-03-08 5:38
I'M NOT GOOD WITH COMPUTERS
I'm trying to make some sort of spamchecker so when a person submits a comment, it is checked against spam.txt and if it doesn't match any of the lines, then it is allowed to continute.
However this bit of code isn't working for me. For example, I have spam.txt with several lines of test words, the first line is derp and when I submit a comment with the word derp it doesn't stop the comment from being submitted. However, when I submit a comment with derp and then a newline, it errors as it's supposed to. But it only does with with the first line. The other lines in spam.txt don't trigger it at all.
Please help me.
sub spamcheck() {
open(SPAM, "<spam.txt") || die 'MISSING';
@raw_data=<SPAM>;
close(SPAM);
for(@raw_data) {
/^(.*)$/;
my $blocked = $1;
die 'SPAM' if $comment =~ $blocked;
}
}I'm trying to make some sort of spamchecker so when a person submits a comment, it is checked against spam.txt and if it doesn't match any of the lines, then it is allowed to continute.
However this bit of code isn't working for me. For example, I have spam.txt with several lines of test words, the first line is derp and when I submit a comment with the word derp it doesn't stop the comment from being submitted. However, when I submit a comment with derp and then a newline, it errors as it's supposed to. But it only does with with the first line. The other lines in spam.txt don't trigger it at all.
Please help me.