Hello List,

I've written a simple guestbook program and, of course, I get spammed like crazy. One of the ways I am trying to avoid this is to keep a list of keywords that, if they show up, cause the post to be rejected by calling a function called "end". Currently, I am implementing it with code like this:

sub process_post {
    my($new_name, $new_location, $new_website, $new_message) @_;
    end() if (
                  $new_website =~ /
                                   info\.aadityasood\.net|
                                   some\.bogus\.website|
                                   another\.bogus\.dummy
                                  /xi
                      ||
                  $new_message =~ /
                                   health insurance|xanax|ringtones|
                                   viagra|cialis|student loans|casino|
                                   demadex|online poker|\[\/url\]|
                                   blackjack
                                  /xi
              );
    # ... SQL insertion code here ....

There's more to it, such as a list of bad IP addresses, but the example sufficiently expresses my point.

I was just wondering, from a regular expression standpoint, if there is a more efficient way to implement this type of comparison. I was thinking perhaps putting all the keywords into various arrays such as @bad_websites and @bad_words, then looping through them, but I'm not sure if that will speed things up or slow things down.

Thanks in advance,

Adam

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to