programmerhead
Programmer
Can anyone tell me what "Premature ending of script headers" mean? I keep getting it in my error log with every script I am running. Here is what my script looks like:
#!/usr/bin/perl
use strict;
use CGI ':standard';
use CGI::Carp qw(fatalsToBrowser);
my $username = param('username');
my $password = param('password');
my ($breaker, $correct, $i, $name);
#THIS SECTION OF CODE IS RESPONSIBLE FOR OPENING THE FILE
print "Content-type: text/html\n\n";
print <<'opening';
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<html xmlns="<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Home of the Boom</title>
<link rel="stylesheet" type="text/css" href="../base.css" />
<script type="text/javascript" languages="javascript" src="../loadimages.js"></script>
<style>A:hover {color: #000000}</style>
</head>
<body link="#3BAAFF" vlink="#3BAAFF" alink="#3BAAFF">
<center><img border="0" src="../images/projectboom.gif" align="center" width="800" height="75" title="Home of the Boom"></center>
<div align="center">
<center>
<table border="0" width="700" cellspacing="0" cellpadding="0">
<tr>
<td width="33%" colspan="3" align="center">
<table border="0" cellspacing="1" cellpadding="0">
<tr height="40">
<td width="10" valign="bottom"><a href="../index.html" onmouseover="document.home.src=tabhomdownon.src"
onmouseout="document.home.src=tabhomdownoff.src">
<img border="0" src="../images/tabhomdownoff.gif" name="home" width="90" title="Home"></a></td> <td width="10" valign="bottom"><a href="../index2.html" onmouseover="document.members.src=tabmemdownon.src"
onmouseout="document.members.src=tabmemdownoff.src">
<img border="0" src="../images/tabmemdownoff.gif" name="members" width="90" title="Members"></a></td>
<td width="10" valign="bottom"><a href="../partyarchive.html"
onmouseover="document.pictures.src=tabpicdownon.src"
onmouseout="document.pictures.src=tabpicdownoff.src">
<img border="0" src="../images/tabpicdownoff.gif" name="pictures" width="90" height="35" title="Pictures"></a></td>
<td width="10" valign="bottom"><a href="../misc.html" onmouseover="document.misc.src=tabmiscdownon.src"
onmouseout="document.misc.src=tabmiscdownoff.src">
<img border="0" src="../images/tabmiscdownoff.gif" name="misc" title="Misc."></a></td>
<td width="10" valign="bottom"><a href="../messageboard.html" onmouseover="document.messageboard.src=tabmesdownon.src"
onmouseout="document.messageboard.src=tabmesdownoff.src">
<img border="0" src="../images/tabmesdownoff.gif" name="messageboard" title="Message Board"></a></td>
</tr>
<tr>
<td colspan="5">
<hr noshade color="#0017C0" size="3"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="33%"></td>
<td width="33%"></td>
<td width="34%"></td>
</tr>
<tr>
<td width="33%"></td>
<td width="33%"></td>
<td width="34%"></td>
</tr>
</table>
</center>
</div>
opening
#THIS SECTION OF CODE IS RESPONSIBLE FOR CHECKING THE USERNAME AND PASSWORD FOR AUTHENTICITY
open (LOG, "< friends.txt" || Error('open','file');
flock (LOG, 2) || Error('lock','file');
my @gol = <LOG>;
close(LOG) || Error('close', 'file');
$i=0;
$breaker=0;
$correct=0;
until($breaker==1){
chop($gol[$i]);
chop($gol[$i]);
if($gol[$i] eq '()()()()'){
$breaker=1;
}
if($username eq $gol[$i]){
$breaker=1;
$i++;
chop($gol[$i]);
chop($gol[$i]);
if($password eq $gol[$i]){
$correct=1;
$i++;
chop($gol[$i]);
chop($gol[$i]);
$name=$gol[$i];
}
}
$i=$i+5;
}
#THIS SECTION OF CODE IS RESPONSIBLE FOR DISPLAYING THE FRIENDS OF BOOM MEMBERS OPTIONS PAGE
if($correct==1){
$password = crypt(1, $password);
print '<center>';
print '<br />';
print "Hello $name, you are logged in as: $username\n";
print '<br /><br />';
print '<table border=0 cellspacing=1 cellpadding=0 width=350>';
print ' <tr>';
print ' <td bgcolor="#017EDE" align="center">';
print ' <font size=6>Friend Of Booom Options:</font>';
print ' </td>';
print ' </tr>';
print ' <tr>';
print ' <td>';
print " <a href=\"exclusivepics.cgi?username=$username&password=$password\">Exclusive Picture Section</a>\n";
print ' </td>';
print ' </tr>';
print ' <tr>';
print ' <td>';
print " <a href=\"directory.cgi?username=$username&password=$password\">Member Directory</a>\n";
print ' </td>';
print ' </tr>';
print ' <tr>';
print ' <td>';
print " <a href=\"profile.cgi?username=$username&password=$password\">Edit Your Profile</a>\n";
print ' </td>';
print ' </tr>';
print '</table>';
print '<br /><br />';
}
#THIS SECTION OF CODE IS RESPONSIBLE FOR PRINTING THE ERROR MESSAGE
if($correct==0){
print '<center>';
print '<br /><br />Either the username or password you have entered is incorrect';
}
#THIS SECTION OF CODE IS RESPONSIBLE FOR ENDING THE HTML FILE
print "</body></html>\n";
#!/usr/bin/perl
use strict;
use CGI ':standard';
use CGI::Carp qw(fatalsToBrowser);
my $username = param('username');
my $password = param('password');
my ($breaker, $correct, $i, $name);
#THIS SECTION OF CODE IS RESPONSIBLE FOR OPENING THE FILE
print "Content-type: text/html\n\n";
print <<'opening';
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<html xmlns="<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Home of the Boom</title>
<link rel="stylesheet" type="text/css" href="../base.css" />
<script type="text/javascript" languages="javascript" src="../loadimages.js"></script>
<style>A:hover {color: #000000}</style>
</head>
<body link="#3BAAFF" vlink="#3BAAFF" alink="#3BAAFF">
<center><img border="0" src="../images/projectboom.gif" align="center" width="800" height="75" title="Home of the Boom"></center>
<div align="center">
<center>
<table border="0" width="700" cellspacing="0" cellpadding="0">
<tr>
<td width="33%" colspan="3" align="center">
<table border="0" cellspacing="1" cellpadding="0">
<tr height="40">
<td width="10" valign="bottom"><a href="../index.html" onmouseover="document.home.src=tabhomdownon.src"
onmouseout="document.home.src=tabhomdownoff.src">
<img border="0" src="../images/tabhomdownoff.gif" name="home" width="90" title="Home"></a></td> <td width="10" valign="bottom"><a href="../index2.html" onmouseover="document.members.src=tabmemdownon.src"
onmouseout="document.members.src=tabmemdownoff.src">
<img border="0" src="../images/tabmemdownoff.gif" name="members" width="90" title="Members"></a></td>
<td width="10" valign="bottom"><a href="../partyarchive.html"
onmouseover="document.pictures.src=tabpicdownon.src"
onmouseout="document.pictures.src=tabpicdownoff.src">
<img border="0" src="../images/tabpicdownoff.gif" name="pictures" width="90" height="35" title="Pictures"></a></td>
<td width="10" valign="bottom"><a href="../misc.html" onmouseover="document.misc.src=tabmiscdownon.src"
onmouseout="document.misc.src=tabmiscdownoff.src">
<img border="0" src="../images/tabmiscdownoff.gif" name="misc" title="Misc."></a></td>
<td width="10" valign="bottom"><a href="../messageboard.html" onmouseover="document.messageboard.src=tabmesdownon.src"
onmouseout="document.messageboard.src=tabmesdownoff.src">
<img border="0" src="../images/tabmesdownoff.gif" name="messageboard" title="Message Board"></a></td>
</tr>
<tr>
<td colspan="5">
<hr noshade color="#0017C0" size="3"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="33%"></td>
<td width="33%"></td>
<td width="34%"></td>
</tr>
<tr>
<td width="33%"></td>
<td width="33%"></td>
<td width="34%"></td>
</tr>
</table>
</center>
</div>
opening
#THIS SECTION OF CODE IS RESPONSIBLE FOR CHECKING THE USERNAME AND PASSWORD FOR AUTHENTICITY
open (LOG, "< friends.txt" || Error('open','file');
flock (LOG, 2) || Error('lock','file');
my @gol = <LOG>;
close(LOG) || Error('close', 'file');
$i=0;
$breaker=0;
$correct=0;
until($breaker==1){
chop($gol[$i]);
chop($gol[$i]);
if($gol[$i] eq '()()()()'){
$breaker=1;
}
if($username eq $gol[$i]){
$breaker=1;
$i++;
chop($gol[$i]);
chop($gol[$i]);
if($password eq $gol[$i]){
$correct=1;
$i++;
chop($gol[$i]);
chop($gol[$i]);
$name=$gol[$i];
}
}
$i=$i+5;
}
#THIS SECTION OF CODE IS RESPONSIBLE FOR DISPLAYING THE FRIENDS OF BOOM MEMBERS OPTIONS PAGE
if($correct==1){
$password = crypt(1, $password);
print '<center>';
print '<br />';
print "Hello $name, you are logged in as: $username\n";
print '<br /><br />';
print '<table border=0 cellspacing=1 cellpadding=0 width=350>';
print ' <tr>';
print ' <td bgcolor="#017EDE" align="center">';
print ' <font size=6>Friend Of Booom Options:</font>';
print ' </td>';
print ' </tr>';
print ' <tr>';
print ' <td>';
print " <a href=\"exclusivepics.cgi?username=$username&password=$password\">Exclusive Picture Section</a>\n";
print ' </td>';
print ' </tr>';
print ' <tr>';
print ' <td>';
print " <a href=\"directory.cgi?username=$username&password=$password\">Member Directory</a>\n";
print ' </td>';
print ' </tr>';
print ' <tr>';
print ' <td>';
print " <a href=\"profile.cgi?username=$username&password=$password\">Edit Your Profile</a>\n";
print ' </td>';
print ' </tr>';
print '</table>';
print '<br /><br />';
}
#THIS SECTION OF CODE IS RESPONSIBLE FOR PRINTING THE ERROR MESSAGE
if($correct==0){
print '<center>';
print '<br /><br />Either the username or password you have entered is incorrect';
}
#THIS SECTION OF CODE IS RESPONSIBLE FOR ENDING THE HTML FILE
print "</body></html>\n";