BlckJckFrnk
Technical User
I'm a novice when it come to script wrting. Been trying to get the below script to work, but no luck. Would appreciate any help.
#!/usr/bin/perl
Print "Content-type:text/plain","\n\n";
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
$mailprog = '/usr/bin/sendmail';
$recipient = 'Frank\@thacherxxxxxx.com';
open MAIL, "|$mailprog -t Frank\@thacherxxxxxx.com" || dienice "Can't access $mailprog!\n";
print MAIL "To: Frank\@thacherxxxxxx.com";
print MAIL "Reply-to: Frank\@thacherxxxxxx.com\n";
print MAIL "Subject: Form Data\n";
print MAIL "Firstname=$FORM{'Firstname'}\n;
print MAIL "Lastname=$FORM{'Lastname'}\n;
print MAIL "Company=$FORM{'Company'}\n;
print MAIL "Address1=$FORM{'Address1'}\n;
print MAIL "Address2=$FORM{'Address2'}\n;
print MAIL "City=$FORM{'City'}\n;
print MAIL "State=$FORM{'State'}\n;
print MAIL "Email=$FORM{'Email'}\n;
print MAIL "Telephone=$FORM{'Telephone'}\n;
print MAIL "Comments=$FORM{'Comments'}\n;
close(MAIL);
print
<html><body>
<h2>Thank you for Contacting Thacher. <a href="/Homepage.htm">home page</a>.
</body></html>
sub dienice {
($errmsg) = @_;
print "<h2>Error</h2>\n";
print "$errmsg<p>\n";
print "</body></html>\n";
exit;
}
#!/usr/bin/perl
Print "Content-type:text/plain","\n\n";
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
$mailprog = '/usr/bin/sendmail';
$recipient = 'Frank\@thacherxxxxxx.com';
open MAIL, "|$mailprog -t Frank\@thacherxxxxxx.com" || dienice "Can't access $mailprog!\n";
print MAIL "To: Frank\@thacherxxxxxx.com";
print MAIL "Reply-to: Frank\@thacherxxxxxx.com\n";
print MAIL "Subject: Form Data\n";
print MAIL "Firstname=$FORM{'Firstname'}\n;
print MAIL "Lastname=$FORM{'Lastname'}\n;
print MAIL "Company=$FORM{'Company'}\n;
print MAIL "Address1=$FORM{'Address1'}\n;
print MAIL "Address2=$FORM{'Address2'}\n;
print MAIL "City=$FORM{'City'}\n;
print MAIL "State=$FORM{'State'}\n;
print MAIL "Email=$FORM{'Email'}\n;
print MAIL "Telephone=$FORM{'Telephone'}\n;
print MAIL "Comments=$FORM{'Comments'}\n;
close(MAIL);
<html><body>
<h2>Thank you for Contacting Thacher. <a href="/Homepage.htm">home page</a>.
</body></html>
sub dienice {
($errmsg) = @_;
print "<h2>Error</h2>\n";
print "$errmsg<p>\n";
print "</body></html>\n";
exit;
}