deadlock Message Board
[ November Full List | Reply ]

Re: I need someone's gracious help
From Hup at AddALL Book Searching and Price Comparison on 27 November '98
replying to I need someone's gracious help posted by Bradley

Try this one. A very general purpose Perl script. It can send out
everything with a format like:

Name_of_the_field1: bla bla
Name_of_the_field2: bla bla bla
...

and, it's only work under Unix.

#!/usr/local/bin/perl5
# Remember to change the path to correct perl directory
################################################################################
# This is the cgi program to print user inputs
# Programmer: Chai-Hup Chen
# Version: 19980623.01
# Copyright 1998 www.AddALL.com. All rights reserved.
#
# This program is a "linkware", if you like it, you should add a link to
# http://www.addall.com.
#
################################################################################

################################################################################
# Change here to fix your need
$TITLE= "Fill-Out Form Result";

$EMAIL= "youremail\@email.com";
$showInput = 1;

$HEADER= "Thanks for visiting our Web Site";
$FOOTER = "<CENTER><HR SIZE=0><FONT SIZE=-1>Copyright 1998 www.AddALL.com. All rights
reserved.</FONT></CENTER>";
# WARNING! Don't change anything below here unless you know what you are doing.
################################################################################
print "Content-type: text/html\n\n";

print <<end_header;
<html>

<title>$TITLE</title>
</head>
<body bgcolor="#ffffff">
<center><h1>$HEADER</h1></center>
end_header

my $buffer;
if($ENV{'REQUEST_METHOD'} eq 'POST')
{ read(STDIN,$buffer, $ENV{'CONTENT_LENGTH'});
} elsif ($ENV{'REQUEST_METHOD'} eq 'GET')
{ $buffer= $ENV{'QUERY_STRING'};
}
my @inputs = split(/&/,$buffer);
my $value; my %Form;
foreach $input (@inputs)
{
($name,$value)= split(/=/,$input);
$value =~ s/%([a-zA-Z0-9][a-zA-Z0-9])/pack('C',hex($1))/eg;
$value =~ s/\+/ /g;
$Form{$name}=$value;
}

open(MAIL, "|/usr/lib/sendmail -t") || die "Can't mail out your submission\n<br>";
print MAIL "TO: $EMAIL\n\n";
foreach $name (keys %Form) {
print MAIL "$name: $Form{$name}\n";
if($showInput) {
print "<B>$name:</B> $Form{$name}<BR>\n";
}
}

close(MAIL);

print <<end_footer;
$FOOTER
</body>

</html>
end_footer


Replies from other people:


Reply to this message

Required Details
Your name:
Subject:

Optional Details
Home page title:
Home page URL:
Email:
(if you'd like to receive
automatic replies by email)

Your Message