#!/usr/bin/perl use CGI qw(:standard); $mailprogram = "/usr/lib/sendmail -t"; print "Content-Type: text/html\n\n"; $cellheight = 398; $yourname = param("anzr"); $yourname =~ s/<[^>]*>//gs; $youremail = param("rznvy"); $youremail =~ s/<[^>]*>//gs; $yourtext = param("obql"); $yourtext =~ s/<[^>]*>//gs; $ouremail = "laserline\@laserline.net"; $referer = param("ersrere"); unless (request_method() eq 'GET') { if (length($yourtext) < 5) { $notext = 1; $resubmit = 1; } unless($youremail =~ /\w+@\w+.\w+/){ $fixemail=1; $resubmit = 1; } } else { $referer=referer(); } if (length($yourname) > 72){ $fatalerror = 1; } if (length($youremail) > 72){ $fatalerror = 1; } if (length($yourtext) > 4095){ $fatalerror = 1; } unless ($resubmit) { if (request_method() eq 'POST') { $thankyou = 1; } } if ($fatalerror) { &sendfatalerror; } elsif ($thankyou) { &sendthankyou; $send_email = 1; } else { &sendform; } $tableheight = $cellheight + 488; $lineheight = $cellheight + 377; $heredoc = <<"BODY_END";
BODY_END if ($send_email) { $remote_addr=remote_addr(); $user_agent=user_agent(); open(MAIL,"|$mailprogram"); print MAIL "To: $ouremail\n"; print MAIL "From: $youremail ($yourname)\n"; print MAIL "Subject: LaserLine email contact form\n"; print MAIL qq{ Remote Addr=$remote_addr User Agent=$user_agent HTTP Referrer=$referer }; print MAIL "\n$yourtext\n"; close MAIL; } print $heredoc; sub sendfatalerror { $cellheight = 72; $cellcontents = <<"CELL_END";
An error occurred. No email was sent. Please email using a different method or contact us by telephone.
CELL_END
}
sub sendthankyou {
$cellheight = 72;
$cellcontents = <<"CELL_END";
Your email has been sent. Thank you for contacting LaserLine.
CELL_END } sub sendform { $cellheight = 398; if (request_method() eq 'GET') { $fixtext = qq{ You may use this form to send email directly to LaserLine.
}; } if ($notext) { $fixtext = qq{ Email not sent. Please type a message and try again.
}; } if ($fixemail) { $fixtext = qq{ Email not sent. Please correct your email address and try again.
};
$fixleft = qq{
};
$fixright = qq{
};
}
$cellcontents = <<"CELL_END";
$fixtext