#!/usr/bin/perl use CGI qw/:standard/; $CGI::POST_MAX=1024 * 1; #$CGI::Validate::IgnoreNonMatchingFields = 1; $fstname = substr param ('first'), 0, 40; $lstname = substr param ('last'), 0, 40; $adda = substr param ('1ad1a'), 0, 60; $addb = substr param ('1ad1b'), 0, 60; $city = substr param ('1ad2'), 0, 60; $state = substr param ('1ad3'), 0, 20; $zip = substr param ('1ad4'), 0, 5; $email = substr param ('eadd'), 0, 70; $phone = substr param ('pnum'), 0, 16; $residence = substr param ('residence'), 0, 9; $yardtype = substr param ('yardtype'), 0, 16; $yardtypeother = substr param ('yardtypeother'), 0, 40; $landlord = substr param ('landlord'), 0, 40; $preadda = substr param ('2ad1'), 0, 60; $precity = substr param ('2ad2'), 0, 60; $prestate = substr param ('2ad3'), 0, 20; $prezip = substr param ('2ad4'), 0, 5; $alone = substr param ('alone'), 0, 14; $household = substr param ('household'), 0, 100; $vet = substr param ('vet'), 0, 45; $pet = substr param ('pet'), 0, 3; $petname = substr param ('petnme'), 0, 30; $currentpets = substr param ('currentpets'), 0, 60; $previouspets = substr param ('previouspets'), 0, 60; $references = substr param ('references'), 0, 140; $ok = substr param ('ok'), 0, 7; ## Clear out unwanted characters $fstname =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $lstname =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $adda =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $addb =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $city =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $state =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $zip =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $email =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $phone =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $residence =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $yardtype =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $landlord =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $preadda =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $precity =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $prestate =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $prezip =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $alone =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $household =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $vet =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $pet =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $petname =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $currentpets =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $previouspets =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $references =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $ok =~ s/[\|\/\\}{\[\]\(\)\*&\^%\$\#<>;:]/ /g; $email =~ tr/[A-Z]/[a-z]/; ## Check email address if (($email ne "") && ($email !~ m/[\w]+@[\w]+\.[\w]+/)) { print "Content-type: text/html\n\n"; print "error (Your email is invalid, please check and resubmit your application)"; exit; } ## Check data $total_form = "$fstname$lstname$email"; if (length($total_form) < 25) { print "Content-type: text/html\n\n"; print "error (The form was incomplete, please check that you filled in your full first and last name, and email address, then resubmit your application.)"; exit; } # residence replace with response ##if ($residence eq "1") ## { ## $residence = "House" ## } ##if ($residence eq "2") ## { ## $residence = "Apartment" ## } $recipient = "email1\@emailsrv1, email2\@emailsrv2, email3\@emailsrv3"; ## Create the email message body $email_message = qq{To: $recipient Subject: Adoption Application From: $fstname $lstname<$email> First name: $fstname Last name: $lstname Current address: $adda $addb $city $state $zip _________________________________________________ Email address: $email Phone number: $phone Type of residence: $residence Yard: $yardtype Landlord contact info: $landlord Previous address: $preadda $precity $prestate $prezip How many hours will pet be alone: $alone Name and age of people in household: $household Veterinarian: $vet Dog or Cat: $pet Name of pet requested: $petname Current pets: $currentpets Previous pets: $previouspets References: $references Aggree to consent form: $ok }; ## Send email $mailprog = '/usr/sbin/sendmail'; open (MAIL, "|$mailprog -t"); print MAIL $email_message; close (MAIL); print "Location: application-submitted \n\n"; exit; __END__