CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
"Premature end of script headers"

 



supaafly
stranger

Jul 18, 2001, 9:59 PM

Post #1 of 3 (1038 views)
"Premature end of script headers" Can't Post

I am currently working on a script, and i need somebody to help me find my errors, please if you can, look at the attached file, it is the script i am working on, and all i see in my error log when i run it is "Premature end of script headers", and i dont really know what that means. Please help. thanks.

----------
Supaafly```



wickedxter
User

Jul 19, 2001, 3:18 PM

Post #2 of 3 (1023 views)
Re: "Premature end of script headers" [In reply to] Can't Post

ok i've fixed your probelm on thing is that the login sub didnt have an end bracket } and the ; after EOF was missing..

CODE:

#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
# Set the password
$passw = "2p28pf";

# Parse the form
&pform;

# Show the login
&login;

# The login sub
sub login {
print <<EOF;

<html>
<head>
<title>Password Screen</title>
<body bgcolor="#000088">
</head>
<form action="./edb.cgi" method="GET">
<input type="hidden" name="action" value="login">
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<table cellpadding="1" cellspacing="0">
<tr>
<td bgcolor="#0000ff">
<table cellpadding="3" cellspacing="0" bgcolor="#000055">
<tr>
<td><font color="#ffffff" size="2" face="verdana">Password</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<table cellpadding="1" cellspacing="0">
<tr>
<td bgcolor="#0000ff">
<table cellpadding="3" cellspacing="0" bgcolor="#000055">
<tr>
<td><input type="password" name="pass"><input type="submit" value="Submit"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
EOF
;
}

# Check if login is correct
if ($input{'action'} eq 'login') {
if ($input{'pass'} eq $passw) {
print "You're in.\n"
} else {
print "Sorry, wrong password.\n"
}
}

# Sub for printing out the page
sub edit_page {
print <<EOF;
<html>
<head><title>Gallery Edit</title>
</head>
<body bgcolor='#000088'>
<table cellpadding='0' cellspacing='0'>
<tr>
<td>
<table cellpadding='1' cellspacing='0'>
<tr>
<td bgcolor='#0000ff'>
<table cellpadding='3' cellspacing='0' bgcolor='#000055'">
<tr>
<td><font color='#ffffff' size='2' face='verdana'>
<h1><i>Gallery edit</i></h1>
<form action='db.cgi' method='GET' ENCTYPE='multipart/form-data'>
<input type='hidden' name='fname' value='$input{'fname'}'>
<input type='hidden' name='desc' value='$input{'desc'}'>
File: <input type='file' name='fname'>
Desc: <input type='text' name='desc' size='20'>
<input type='Submit' value='Finish'>
</form>
</font>
</font>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
EOF
;
}

# The sub to parse the form
sub pform {

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
if (length($buffer) < 5) {
$buffer = $ENV{QUERY_STRING};
}
@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;

$input{$name} = $value;
}
}




supaafly
stranger

Jul 19, 2001, 5:08 PM

Post #3 of 3 (1017 views)
Re: "Premature end of script headers" [In reply to] Can't Post

Nope, it didnt work, but i have found a diffrent way. Thanks anyway. :)

----------
Supaafly```


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives