On Tue, 20 Nov 2007 08:25:15 -0500, "Lou Hernsen"
<[EMAIL PROTECTED]> wrote:

>Hallo
>I'm just an amature perl writer..
>but I would think that using the m// (match) would help. somthing like
># $CONFIG{'Feedback'} = the body of the message, change to whatever it is in
>the program
>if ($CONFIG{'Feedback'} =~  /href=|http:/i ) #i = ignore case
>{
>    # reject code goes here
>    exit;
>}
>
>As to preventing cusswords... good luck...
>you could do a string substitution manure is replaced by fertilizer
>
>s/manure/fertilizer/i;
>
>this way the offender never knows what words are being replaced and is less
>likely to try to get around this code with words like schist, or phuque or
>the like.. I think you get my drift.
>
>And I would do the word check right when the words are being parsed.
>Thats how I would do it, but then what do I know..
>I'm sure there are better ways... and that certain people on this list will
>be quick to shoot me down
>while offering no help of there own... but I wanted to get my "good deed"
>for the day thing out of the way this morning ;)

Appreciated!

>hope it helps.
>Lou

Thanks,
I think it is a help in the right direction! :-)
I thought of adding one more checking function in the middle of the
sequence of the main function like this:

...
# Parse Form Contents
&parse_form;

# Reject spammers <== This is what I like to add
&spam_reject;

# Check Required Fields
&check_required;
...

Then I would have the new function doing something like this using
your example and the existing code for other checks:

sub spam_reject {
  if ($CONFIG{'Feedback'} =~  /href=|http:/i ) #i = ignore case
  {
      # reject code goes here
      push(@ERROR,'*SPAM*');
  }

  if (@ERROR) {
      &error('spam_contents', @ERROR);
  }

}

Then I would add something like this to the error subroutine in the
middle of the error causes parsing:

   elsif ($error eq 'spam_contents') {
     print "<html>\n <head>\n <title>Error: SPAM</title>\n </head>\n";
     print "</head>\n <body";

     # Get Body Tag Attributes
     &body_attributes;

     # Close Body Tag
     print ">\n <center>\n\n";
     print " <h1>Error: **** SPAM! ****</h1>\n </center>\n\n";
     print "<p>The data you entered is considered SPAM!</p>\n";
     print "</body></html>\n";
   }

There is an exit at the end of the error subroutine already.

Do you think that this would work?


Bo Berglund


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


Reply via email to