Thread View: best.www
3 messages
3 total messages
Started by Andy
Thu, 30 Sep 1999 00:00
CGI script help please!
Author: Andy
Date: Thu, 30 Sep 1999 00:00
Date: Thu, 30 Sep 1999 00:00
100 lines
2911 bytes
2911 bytes
Listed below is script I have use at another ISP that worked fine... but I
can't seem to get to work at Best on server fpage2
I have followed all the suggestions list the "common reasons why CGI scripts
fail", but still can't get it work. I must be missing something very basic
Can some hotshot cgi'ers spot my errors?
Best regards,
Andy
=============================
#!/usr/local/bin/perl
#run subroutine to turn stdin into an array named %in
require "cgi-lib.pl";
&ReadParse;
#store location of mail program in variable
#your mail program's locale may differ
$mailprog = '/usr/sbin/sendmail';
#use cgi-lib.pl subroutine to set content type
print &PrintHeader;
unless (-e $mailprog)
{
print <<"PrintTag";
<HTML><BODY>
<H3>Cannot find $mailprog.</H3>
<P>There is a typo in the mail program path.</P>
</BODY></HTML>
PrintTag
exit(0);
}
#create confirmation web page
print <<"PrintTag";
<HTML><HEAD>
<TITLE>Thanks for responding!</TITLE>
</HEAD>
<BODY BGCOLOR=\"white\" TEXT=\"black\">
<H2>Thank You!</H2>
<P>Thanks for filling out our form.</P>
<P>Check your e-mail for a message from us.</P>
<!-- change the URL below to YOUR home page -->
<a href="http://www.apresearch.com">Home</a>
</body></html>
PrintTag
#open mail program
open (MAIL, "|$mailprog") || die "Can't open $mailprog\n";
#print message headers (to, from, subject, etc)
print MAIL "To: $in{'email'}\n";
print MAIL "Reply-To: $in{'empmail'}\n";
print MAIL "From: $in{'empmail'}\n";
print MAIL "Subject: Your catalog request.\n\n";
#print body of message
print MAIL << "PrintTag";
Dear $in{'custname'}:
Thank you for writing. This e-mail confirms that
we have received your request for a catalog.
Please look for it soon!
Sincerely yours,
Joe BlowBig
Impersonal Corporation
PrintTag
#close mail program, releasing message to be sent
close(MAIL);
#open mail program for a second message to employee
open (MAIL, "|$mailprog") || die "Can't open $mailprog\n";
#print message headers
print MAIL "To: $in{'empmail'}\n";
print MAIL "Reply-To: $in{'email'}\n";
print MAIL "From: $in{'email'}\n";
print MAIL "Subject: Catalog Order.\n\n";
#create body of message
print MAIL << "PrintTag";
Please rush a catalog to:
$in{'custname'}
$in{'street'}
$in{'city'} $in{'state'} $in{'zip'}
$in{'country'}
$in{'comments'}
PrintTag
#close mail program and send message
close(MAIL);
#end of program
Re: CGI script help please!
Author: Bill Moseley
Date: Thu, 30 Sep 1999 00:00
Date: Thu, 30 Sep 1999 00:00
31 lines
1377 bytes
1377 bytes
Andy (aprophet@apresearch.com) seems to say...
> Listed below is script I have use at another ISP that worked fine...
> but I can't seem to get to work at Best on server fpage2
Get it to work? What kind of work? You mean mow your lawn?
What happens when you run it from the command line as ./program.pl or
what ever it's called?
Does the web server have permission to run it?
> $mailprog = '/usr/sbin/sendmail';
> #open mail program
> open (MAIL, "|$mailprog") || die "Can't open $mailprog\n";
>
> #print message headers (to, from, subject, etc)
> print MAIL "To: $in{'email'}\n";
How's sendmail suppose to know who to deliver the mail to? I'd think
you would want to use a sendmail switch or two.
> close(MAIL);
I'd check the return value here, as that's where errors show up on pipe
opens.
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
Re: CGI script help please!
Author: Andy
Date: Thu, 30 Sep 1999 00:00
Date: Thu, 30 Sep 1999 00:00
55 lines
2180 bytes
2180 bytes
Bill, thanks for the quick reply. It's always nice to know someone is
willing to help a total newbie like me.
Listed below are my comments:
>
>Get it to work? What kind of work? You mean mow your lawn?
>
I get following:
===========
The server encountered an internal error or misconfiguration and was unable
to complete your request.
Please contact the server administrator, and inform them of the time the
error occurred, and anything you might have done that may have caused the
error.
More information about this error may be available in the server error log.
========
>What happens when you run it from the command line as ./program.pl or
>what ever it's called?
>
I am not familar with this command. Can explain what is "./program.pl "?
>Does the web server have permission to run it?
>
How can I determine if the server has permission to run the script?
>
>> $mailprog = '/usr/sbin/sendmail';
>> #open mail program
>> open (MAIL, "|$mailprog") || die "Can't open $mailprog\n";
>>
>> #print message headers (to, from, subject, etc)
>> print MAIL "To: $in{'email'}\n";
>
>How's sendmail suppose to know who to deliver the mail to? I'd think
>you would want to use a sendmail switch or two.
>
My web form has a line that defines the email location as follows:
=====
<input type="hidden" name="empmail" value="aprophet@apresearch.com">
=====
>> close(MAIL);
>
>I'd check the return value here, as that's where errors show up on pipe
Pipe? What do you mean by pipe?
>opens.
>
>
>--
>Bill Moseley mailto:moseley@best.com
>pls note the one line sig, not counting this one.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads