Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

first script stalls on launchpad! returns "Premature end of script..."

Status
Not open for further replies.

spewn

Programmer
May 7, 2001
1,034
okay, here's the script (below). the form is at when the form is submitted, it returns this...

********

Premature end of script headers: /data1/hm/one-degree.com/cgi-bin/readInput.cgi

********

here is readInput.cgi


#!/usr/local/bin/perl

%postInputs = readPostInput();
$dateCommand = "date";
open (MAIL, "|/var/qmail/bin/qmail-inject -t") || return 0;

select (MAIL);
print << &quot;EOF&quot;;
To: g@one-degree.com
From: $postInputs{'Contact_Email'}
Subject: $postInputs{'Organization'} Information Requested
$time
$postInputs{ 'Organization' } Information Requested
Name: $postInputs{'Contact_FullName'}
Email: $postInputs{ 'Contact_Email'}
Street Address: $postInputs{ 'Contact_StreetAddress'}
Street Address (cont.): $postInputs{ 'Contact_Address2'}
City: $postInputs{ 'Contact_City'}
State: $postInputs{ 'Contact_State'}
Zip: $postInputs{ 'Contact_ZipCode'}
Work Phone: $postInputs{ 'Contact_WorkPhone'}
Home Phone: $postInputs{ 'Contact_HomePhone'}
FAX: $postInputs{ 'Contact_FAX'}
Email: $postInputs{ 'Contact_Email'}
Comments: $postInputs{ 'comments'}


EOF
close(MAIL);
select(STDOUT);
printThankYou();

sub readPostInput(){

my (%searchField, $buffer, $pair, @pairs);
if ($ENV{'REQUEST_METHOD'} eq 'POST'){
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(&quot;C&quot;, hex($1))/eg;
$name = =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(&quot;C&quot;, hex($1))/eg;
$searchField{ $name} = $value;

}
}

return (%searchField);

}

sub printThankYou(){

print << &quot;EOF&quot;;

Content-Type: text/html

<head>
<title>THANK YOU FOR YOUR REQUEST</title>
</head>
<body>
<table cellspacing=2 cellpadding=2 border=0 width=600>
<tr><th><br>
<center>
<font size=+3><b>Thank You $postInputs{'Contact_FullName'}</b></font>
</center><br><br>

<center><b><font size=+1><p>For submitting your information. We will get back to you shortly.</p>
</b>
</font>
<center>
</th></table>
</body>
</html>

EOF
}



Anyone see potential hazards and problem? -crispy
 
I think so. The line break in front of the Content-type --

Code:
print << &quot;EOF&quot;;
 
Content-Type: text/html

See if that does it. Good luck.

brendanc@icehouse.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top