Jump to content


This topic is now archived and is closed to further replies.


Need help with a simple blog script

Recommended Posts

Hey guys.. I'm a noob to PHP so I'm not sure if I'm going the wrong direction with this or what, but this is what I'm trying to do.  I'm made a simple blog form with a password to post to a blog page... you know, only one user can post... they know the password, so they can post and tada! It posts to the blog page.  Well... my problem is, I can't get the new blogs to post on TOP of older blogs like a normal blog should...they post at the bottom.  I know this is because of the parameters used with fopen but I can't figure out how to get them to the top.  I tried making a temp variable to hold the information, write the new data, then write the old data under it but I guess I did something wrong because it's not working... and "Resource ID #5" keeps posting under the blog posts, lol. 

Anywho.. here's the code I have as of right now:

$pwd = $_POST["password"];
$new_content = "<div><b>" . $date = $_POST["date"] . "</b><br /><br /><i>" . $subject = $_POST["subject"] . "</i><br /><br />" . $blog = $_POST["blog"] . "</div><hr size='1'>";
if (!$old_content = fopen("blog1.php", "a+")) {
else if ($pwd == "password1234") {
$old_content = fopen("blog1.php", "a+");
$tmp_old_content = fopen("blog1.php", "a+");
fwrite($old_content, $new_content);
fwrite($old_content, $tmp_old_content);
else {

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.