#!/usr/bin/perl # parse form input read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($key, $value) = split (/=/, $pair); $key =~ tr/+/ /; $key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~s///g; if ($formdata{$key}) { $formdata{$key} .= ", $value"; } else { $formdata{$key} = $value; } } # begin output print "Content-type: text/html\n\n"; # print header print "\n"; print "\n"; print "chagrin valley roller rink, inc.\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n\n"; # print body print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
chagrin valley roller rink
skating parties
birthday party confirmation submission results
 \;
\n\n"; print "thank you for your confirmation
\ \;
\n"; print "you will receive a response within 48 hours
\ \;
\n"; # form results begin here # email address print "your email address is:
$formdata{'email_primary'}
\ \;
\n"; # party information print "your party is for:
$formdata{'name_first2'} $formdata{'name_last2'}\n"; if ($formdata{'name_first3'} ne ""){ print "and $formdata{'name_first3'} $formdata{'name_last3'}\n"; } print "
\n"; print "$formdata{'party_type'} birthday party on $formdata{'session_date'}
\n"; print "skating session time is $formdata{'session_time'}
\n"; print "party room reservation time is $formdata{'party_time2'}
\n"; print "you are expecting $formdata{'guests'} guests
\n"; if ($formdata{'party_type'} eq "deluxe"){ print "$formdata{'cake'}
\ \;\n"; } else { print "\ \;\n"; } print "
\n"; # comments if ($formdata{'comment'} ne ""){ print "your comments are:
$formdata{'comment'}
\ \;\n"; } # form results end here print "
\n"; print "\n"; print ""; # email results to forms@cvrr.com $to = "forms\@cvrr.com"; $from = $formdata{'email_primary'}; $subject = "birthday party confirmation"; $content = " Sender Information: $formdata{'name_first'} $formdata{'name_last'} $formdata{'address_street'} $formdata{'address_city'}, $formdata{'address_state'} $formdata{'address_zip'} Primary Phone: $formdata{'phone_primary_1'}-$formdata{'phone_primary_2'}-$formdata{'phone_primary_3'} Secondary Phone: $formdata{'phone_secondary_1'}-$formdata{'phone_secondary_2'}-$formdata{'phone_secondary_3'} Primary Email: $formdata{'email_primary'} Secondary Email: $formdata{'email_secondary'} Party Information: Guest of Honor 1: $formdata{'name_first2'} $formdata{'name_last2'} Guest of Honor 2: $formdata{'name_first3'} $formdata{'name_last3'} Party Type: $formdata{'party_type'} Party Date: $formdata{'session_date'} Session Time: $formdata{'session_time'} Party Time: $formdata{'party_time2'} Number of Guests: $formdata{'guests'} Cake Type: $formdata{'cake'} Comments/Questions: $formdata{'comment'} "; open(MAIL, "|/usr/lib/sendmail -t") || exit; print MAIL "To: $to\nFrom: $from\n"; print MAIL "Subject: $subject\n"; print MAIL "$content\n"; close(MAIL);