Append to top of file???
Posted: Sat Aug 09, 2003 6:24 pm
I was wondering if there was a way to append stuff to the top of the file instead of the bottom
Code: Select all
<html>
<head>
<title>Whatever</title>
</head>
<body>
<table align=center border=1 bordercolor=#000069 cellpadding=2 cellspacing=0>
<?php
$username = $_POSTї'PosterName'];
$header = $_POSTї'header'];
$pass = $_POSTї'Password'];
$comments = $_POSTї'Comments'];
if(($username == 'I2' && $pass == 'I321') || ($username == '12345' && $pass == '12345') || ($username == '23o' && $pass == 'e23t')){
$fp = fopen("comments.cs", "a+");
if($fp){
$curDate = date("F jS, Y");
$acommentї0] = "<table cellspacing='0' cellpadding='0' width='350' class='Header'>";
$acommentї1] = "<tr><td width='13' class='left'></td>";
$acommentї2] = "<td height='33' valign='center' class='main'><p align='center'> >> $header ($curDate)</td>";
$acommentї3] = "<td width='13' class='right'></td></tr></table>";
$acommentї4] = "<table border='1' cellspacing='0' cellpadding='3' style='border-collapse: collapse' bordercolor='#AAAAAA' id='AutoNumber1' width='330'>";
$acommentї5] = "<tr><td bgcolor='#DDDDDD'><font size='2' color='#000000'> $comments";
$acommentї6] = "<p align='right'>-$username</font></td></tr></table><br><br>";
for($i = 0; $i < 7; $i++) fputs($fp, stripslashes($acommentї$i]), strLen($acommentї$i]));
fclose($fp);
}else{
echo "<tr><td>Could not open file, comments.cs</td></tr>";
}
}else{
echo "<tr><td>Invalid UserName and/or Password.</td></tr>";
}
?>
<tr><td>Click <a href="http://www.planettribes.com/daf/habitat_Entity/">here</a> to return to main page.</td></tr>
</table>
</body>
</html>