jazzwill has asked for the wisdom of the Perl Monks concerning the following question:
#The parsing part:sub sendMail { $email = $FORM{'Email'} ; if (length $email > 80) { &Show_Critical_Error ('Email Address too long!'); } if ($email =~ /^[^@]+@([-\w]+\.)+[A-Za-z]{2,4}$/) { open(MAIL, "|$email_path -t -oi -odq") || &Show_Critical_Error('Sy +stem Error. Unable to open mail application.') ; print MAIL "To: myemail\@mydomain.com(my domain name)\n" ; print MAIL "From: $FORM{'Email'} (JazzKids SITE)\n" ; print MAIL "Subject: WEBSITE CONTACT-jazzkids\n" ; print MAIL "\n" ; print MAIL "Name: $FORM{'Name'}\n\n" ; print MAIL "Email: $FORM{'Email'}\n\n" ; print MAIL "Address: $FORM{'Address'}\n\n" ; print MAIL "City: $FORM{'City'}\n\n" ; print MAIL "State: $FORM{'State'}\n\n" ; print MAIL "Zip: $FORM{'Zip'}\n\n" ; print MAIL "Specialty: $FORM{'Specialty'}\n\n" ; print MAIL "Best to reach by: $FORM{'Reachby'}\n\n" ; print MAIL "Best to reach when: $FORM{'Reachwhen'}\n\n" ; print MAIL "Comments: $FORM{'Comments'}\n\n" ; print MAIL "----------------------------------------\n\n" ; print MAIL "Sent from: $FORM{'form'}\n\n" ; close(MAIL) ; } else {&Show_Critical_Error('EMAIL ADDRESS INVALID.') ;} }
THANKS for any help!!sub Parse_Post_Form { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}) ; @pairs = split(/&/, $buffer) ; $valid = "[A-Za-z]\@\:\." ; foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair) ; $value =~ tr/+/ / ; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg ; $value =~ s/[^$valid]/./go; $FORM{$name} = $value ; if ($value =~ s/`//) { &Show_Critical_Error ('No back ticks allowed!'); } } }
Edit by castaway - removed extra br tags inside code tags
Considered by VSarkiss: Delete: dup of Reaped: Perl Security which has replies
Unconsidered by Arunbear: keep votes prevented reaping; Keep/Edit/Delete: 15/5/18
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl Security - Prevent SPAM
by techcode (Hermit) on Oct 07, 2005 at 01:48 UTC | |
by jazzwill (Initiate) on Oct 07, 2005 at 03:04 UTC | |
by GrandFather (Saint) on Oct 07, 2005 at 03:12 UTC | |
by jazzwill (Initiate) on Oct 07, 2005 at 11:43 UTC | |
by eXile (Priest) on Oct 07, 2005 at 14:10 UTC | |
|
Re: Perl Security
by Zed_Lopez (Chaplain) on Oct 07, 2005 at 00:32 UTC | |
|
Re: Perl Security
by cowboy (Friar) on Oct 07, 2005 at 17:49 UTC |