JD:

Thanks - really appreciate the help. Some of this looks like I can maybe
translate it.

Couple of questions though. I set up an html doc (see below) and took input
called email and ip and posted it to the name of the cgi form (testxx.pl). I
also changed your email address to mine (just cut and pasted). Figuring that
the individual who will complete the form - why do we collect the ip address
(since most won't know theirs anyway). I see that you've indicated an ENV
argument with the ip -- do I need to do something with the environment on
their side??

Finally - I set the two scripts up on my wife's remote server and ran it - I
received the following error in her error log:

Undefined subroutine &main::ReadParse called at
/www/tightweb/tightweb.com/cgi-bin/testxx.pl line 8.
[Thu Jan 30 12:36:37 2003] [error] [client 68.13.40.38] Premature end of
script headers:


I then set it up on my own linux box and received the following error:

Thu Jan 30 12:46:36 2003] [error] (8)Exec format error: exec of
/var/www/cgi-bin/testxx.pl failed
[Thu Jan 30 12:46:36 2003] [error] [client 192.168.0.193] Premature end of
script headers: /var/www/cgi-bin/testxx.pl

This is the html doc I put together for this test

<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<FORM method="POST" action="http://mainserver/cgi-bin/testxx.pl";>
Email Address: <INPUT type="text" name="email"><br>
IP Address: <INPUT type="text" name="ip"><br>
<INPUT type="submit">
</FORM>
</body>
</html>

This is your script - which I put in the cgi-bin

/usr/bin/perl

#basically...just like the example i sent this is gets the vars
#that get sent from the web-page. $in{content} == the content
# the senders is anonamus...there we get there ip and they must supply a
# return email address

&ReadParse;

##Did this to vars so perl would not interep @ and "." in ipaddr
$email = "\'$in{email}\'";
$ip = "\'$ENV{'REMOTE_ADDR'}\'";

##test for @ to make sure ther is a return address if not give other
#html this is a very lame test
unless ($email =~ /\@/){
        print "Content-type: text/html\n\n";
        print "<html><head><title>hi</title></head><body>";
        print "You forgot to include your email address\n";
        print "Please click back on your browser and try again";
        print "</body></html>";
}
else{
##pipe to sendmail and send mail with return email and ip
    open(MAIL, "|/bin/mail -s WEB_REPLY geringer2\@cox.net");
        print MAIL "$in{content}\n";
        print MAIL "email address: $email\n";
        print MAIL "ip: $ip\n";
    close(MAIL);
##make confirm page
     print "Content-type: text/html\n\n";
     print "<html><head><title>hi</title></head><body>";
     print "your mail has been sent all replies will be sent to:";
     print "$in{email}\n";
     print "</body></html>";
}

Other than changing the email address, nothing else was altered - I cut and
pasted it from your email.

Any help you can give me on these - I would appreicate. thanks

Ron

Reply via email to