Page 1 of 1

server error

Posted: Tue Dec 02, 2003 12:11 am
by Vietboy
Server Error
The server encountered an error attempting to retrieve the requested resource. Please notify the owner of the problem.

Error notes: Premature end of script headers: /guestbook/insert.php

Why does this happen?

this is insert.php

Code: Select all

<?
$filewrite = "messages.txt";
$stanb = "read.php";
$linea1 = "<font face='Verdana' size='2'>Name: $nome</font>\n";
$linea2 = "<br><font face='Verdana' size='2'>E-mail: $email</font>\n";
$linea3 = "<br><font face='Verdana' size='2'>Comments:\n$messaggio</font>\n";
$linea3 = ereg_replace("\n","<br>",$linea3);
$linea3 = ereg_replace(":\(", "<img src="images/triste.gif">",$linea3);
$linea3 = ereg_replace(":)", "<img src="images/smile.gif">",$linea3);
$linea3 = ereg_replace(":D", "<img src="images/sorrisone.gif">",$linea3);
$linea3 = ereg_replace(";o", "<img src="images/redface.gif">",$linea3);
$linea3 = ereg_replace(":P", "<img src="images/tongue.gif">",$linea3);
$linea3 = ereg_replace(";)", "<img src="images/wink.gif">",$linea3);
$linea3 = ereg_replace(":o)", "<img src="images/clown.gif">",$linea3);
$linea3 = ereg_replace("8)", "<img src="images/shy.gif">",$linea3);
$linea3 = ereg_replace(":x", "<img src="images/kisses.gif">",$linea3);
$linea3 = ereg_replace(";=\(", "<img src="images/evil.gif">",$linea3);
$linea3 = ereg_replace(":I", "<img src="images/blush.gif">",$linea3);
$linea3 = ereg_replace("\?", "<img src="images/question.gif">",$linea3);
$linea3 = ereg_replace("0]", "<img src="images/alien.gif">",$linea3);
$linea3 = ereg_replace(":O", "<img src="images/shock.gif">",$linea3);
$linea3 = ereg_replace(":lol", "<img src="images/laugh.gif">",$linea3);
$linea3 = ereg_replace(":smokin", "<img src="images/smokin.gif">",$linea3);
$linea3 = ereg_replace(":rollin", "<img src="images/roll.gif">",$linea3);
$linea3 = ereg_replace(":hat", "<img src="images/pimp.gif">",$linea3);
$linea4 = date ("d/m/Y H:i")."\t";
$linea5 = "&nbsp; Ip:&nbsp;" .gethostbyaddr($REMOTE_ADDR)." ($REMOTE_ADDR)";
$linea6 = "<br><center><img src='redline.jpg' width=100% height=1 border=0></center>\n";
$file = fopen ("$filewrite", "a+");
$stringa = "$linea1 $linea2 $linea3 $linea4 $linea5 $linea6";
fputs ($file, $stringa);
fclose ($file);
include ("read.php");
?>
this is for read.php

Code: Select all

<?
$filewrite = "messages.txt";
include("$filewrite");
?>
post.htm

Code: Select all

<html>

<head>
<title>GB</title>
</head>

<body>


<div align="center">
  <center>
  <table border="0" width="894" height="370">
    <tr>
      <td width="373" height="370" valign="top" rowspan="19"><form method="POST" action="insert.php">
<font face="Verdana" size="2">Name:&nbsp;</font>
<br>
<font face="Verdana" size="2"> <input type="text" NAME="nome" size="27"></font>
<font face="Verdana" size="2"><br>E-mail:&nbsp;</font>
<br>
<font face="Verdana" size="2"> <input type="text" NAME="email" size="27"></font>
<font face="Verdana" size="2"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  Comments:</font>
  <br><font face="Verdana" size="2"><textarea rows="8" NAME="messaggio" cols="27"></textarea></font>
  <p><input type="submit" value="Send" NAME="stanb"><input type="reset" value="Reset" name="B2"></p>
</form>
</td>
  </center>
      <td width="505" height="22" valign="top" colspan="2">
        <p align="left"><font face="Verdana" size="2">Emoticon:</font></td>
    </tr>
  <tr>
      <td width="107" height="1" valign="top"><font face="Verdana" size="2">:)</font>
      </td>
      <td width="392" height="1" valign="top"><img border="0" src="images/smile.gif" width="15" height="15">
      </td>
  </tr>
  <tr>
      <td width="107" height="5" valign="top"><font face="Verdana" size="2">:(</font>
      </td>
      <td width="392" height="5" valign="top"><img border="0" src="images/triste.gif" width="15" height="15">
      </td>
  </tr>
  <tr>
      <td width="107" height="12" valign="top"><font face="Verdana" size="2">:D</font>
      </td>
      <td width="392" height="12" valign="top"><img border="0" src="images/sorrisone.gif" width="15" height="15">
      </td>
  </tr>
  <tr>
      <td width="107" height="17" valign="top"><font face="Verdana" size="2">:P</font>
      </td>
      <td width="392" height="17" valign="top"><img border="0" src="images/tongue.gif" width="15" height="15">
      </td>
  </tr>
  <tr>
      <td width="107" height="21" valign="top"><font face="Verdana" size="2">;)</font>
      </td>
      <td width="392" height="21" valign="top"><img border="0" src="images/wink.gif" width="15" height="15">
      </td>
  </tr>
  <tr>
      <td width="107" height="17" valign="top"><font face="Verdana" size="2">;o</font>
      </td>
      <td width="392" height="17" valign="top"><img border="0" src="images/redface.gif" width="15" height="15">
      </td>
  </tr>
  <tr>
      <td width="107" height="22" valign="top"><font face="Verdana" size="2">:o)</font>
      </td>
      <td width="392" height="22" valign="top"><img border="0" src="images/clown.gif" width="15" height="15">
      </td>
  </tr>
  <tr>
      <td width="107" height="19" valign="top"><font face="Verdana" size="2">8)</font>
      </td>
      <td width="392" height="19" valign="top"><img border="0" src="images/shy.gif" width="15" height="15">
      </td>
  </tr>
  <tr>
      <td width="107" height="16" valign="top"><font face="Verdana" size="2">:x</font>
      </td>
      <td width="392" height="16" valign="top"><img border="0" src="images/kisses.gif" width="15" height="15">
      </td>
  </tr>
  <tr>
      <td width="107" height="19" valign="top">
      <font face="Verdana" size="2">;=(</font>
      </td>
      <td width="392" height="19" valign="top">
      <img border="0" src="images/evil.gif" width="15" height="15">
      </td>
  </tr>
  <tr>
      <td width="107" height="19" valign="top">
      <font face="Verdana" size="2">:I</font>
      </td>
      <td width="392" height="19" valign="top">
      <img border="0" src="images/blush.gif" width="15" height="15">
      </td>
  </tr>
  <tr>
      <td width="107" height="9" valign="top">
      <font size="2" face="Verdana">:O</font>
      </td>
      <td width="392" height="9" valign="top">
      <img border="0" src="images/shock.gif" width="15" height="15">
      </td>
  </tr>
  <tr>
      <td width="107" height="13" valign="top">
      <font size="2" face="Verdana">?</font>
      </td>
      <td width="392" height="13" valign="top">
      <img border="0" src="images/question.gif" width="15" height="15">
      </td>
  </tr>
  <tr>
      <td width="107" height="16" valign="top">
      <font size="2" face="Verdana">0]</font>
      </td>
      <td width="392" height="16" valign="top">
      <img border="0" src="images/alien.gif" width="15" height="15">
      </td>
  </tr>
  <tr>
      <td width="107" height="18" valign="top">
      <font size="2" face="Verdana">:lol</font>
      </td>
      <td width="392" height="18" valign="top">
      <font size="2" face="Verdana"><img border="0" src="images/laugh.gif" width="15" height="15"></font>
      </td>
  </tr>
  <tr>
      <td width="107" height="20" valign="top">
      <font size="2" face="Verdana">:smokin</font>
      </td>
      <td width="392" height="20" valign="top">
      <font size="2" face="Verdana"><img border="0" src="images/smokin.gif" width="21" height="15"></font>
      </td>
  </tr>
  <tr>
      <td width="107" height="8" valign="top">
      <font size="2" face="Verdana">:rollin</font>
      </td>
      <td width="392" height="8" valign="top">
      <img border="0" src="images/roll.gif" width="50" height="15">
      </td>
  </tr>
  <tr>
      <td width="107" height="16" valign="top">
      :<font face="Verdana" size="2">hat</font>
      </td>
      <td width="392" height="16" valign="top">
      <img border="0" src="images/pimp.gif" width="22" height="23">
      </td>
  </tr>
  </table>
</div>


</body>

</html>

Posted: Tue Dec 02, 2003 1:14 am
by Weirdan
insert.php:

Code: Select all

<? 
header("Content-Type: text/html");
$filewrite = "messages.txt"; 
$stanb = "read.php"; 
$linea1 = "<font face='Verdana' size='2'>Name: $nome</font>\n"; 
$linea2 = "<br><font face='Verdana' size='2'>E-mail: $email</font>\n"; 
$linea3 = "<br><font face='Verdana' size='2'>Comments:\n$messaggio</font>\n"; 
$linea3 = ereg_replace("\n","<br>",$linea3);
//......skipped

Posted: Tue Dec 02, 2003 1:28 am
by Vietboy
Okie now it works..

but the the stuff i type doesn't work

These show:

It should have name, e-mail, and comments

01/12/2003 23:29 Ip: ()


Name:
E-mail:
Comments:

01/12/2003 23:30 Ip: ()


Name:
E-mail:
Comments:

01/12/2003 23:30 Ip: ()

Posted: Tue Dec 02, 2003 6:08 pm
by Vietboy
any one know why it doesn't show what i type?

Posted: Tue Dec 02, 2003 6:16 pm
by microthick
On this page, try using $_POST["nome"] rather than $nome. Same for your other fields.

Posted: Tue Dec 02, 2003 6:27 pm
by Vietboy
now I did that

Code: Select all

<? 
$filewrite = "hymessages.txt";
$stanb = "hyread.php";
$linea1 = "<font face='Verdana' size='2'>Name: $_POST&#1111;"nome"]</font>\n";
$linea2 = "<br><font face='Verdana' size='2'>E-mail: $_POST&#1111;"email"]</font>\n";
$linea3 = "<br><font face='Verdana' size='2'>Comments:\n$_POST&#1111;"messaggio"]</font>\n";
when I submit, the page from post.htm goes to insert.php and stuck there.. didn't do nothing

in the status said done. in the url list is insert.php

Posted: Tue Dec 02, 2003 7:48 pm
by microthick
Ok, did you check your file to see if anything wrote to it?

Posted: Tue Dec 02, 2003 8:08 pm
by infolock
veitboy, care to be a little more clear? when you say
when I submit, the page from post.htm goes to insert.php and stuck there.. didn't do nothing
do you mean it didn't display any text? or that it didn't write to the file? or something else?


also, when you are gonna post code, use the PHP button instead of CODE.

much easier to read that way

Posted: Wed Dec 03, 2003 1:31 am
by Vietboy
it didn't write any text or display any texts, just a white blank screen

Posted: Wed Dec 03, 2003 10:22 pm
by Vietboy
what should i do next?