ethicalkidnap
New Member
- Messages
- 2
- Reaction score
- 0
- Points
- 0
Hey guys, I'm new here, as you can probably tell.
I have a little problem with a certain PHP script.
I'm trying to create a bulletin type system where an admin can enter a message into the given text area and it appears on the front page, but only using text files and the fopen() and fwrite() functions.
The problem I'm having is that I need the newest posts to appear above the older posts, I've done it before but have completely forgotten how I did it xD
So far I have:
I know the fopen() mode is wrong, and that's part of the problem >.>
I also know I need the pointer to back to the top of the document, and I've tried rewind() and fseek(), but they haven't worked
Does anyone have an idea of how I would go about acheiving what I want to do?
I have a little problem with a certain PHP script.
I'm trying to create a bulletin type system where an admin can enter a message into the given text area and it appears on the front page, but only using text files and the fopen() and fwrite() functions.
The problem I'm having is that I need the newest posts to appear above the older posts, I've done it before but have completely forgotten how I did it xD
So far I have:
PHP:
<?php
$date = date("D M j G:i:s");
$file = 'body.txt';
$inf = "<b>".$date."</b><br />".stripslashes($_POST['index'])."<br /><br />";
!$handle = fopen($file, 'a');
fwrite ($handle, $inf);
echo "Success, wrote text to <a href='index.php'>index</a>";
fclose($handle);
?>
I know the fopen() mode is wrong, and that's part of the problem >.>
I also know I need the pointer to back to the top of the document, and I've tried rewind() and fseek(), but they haven't worked
Does anyone have an idea of how I would go about acheiving what I want to do?
Last edited: