mysterio2099 Posted October 3, 2006 Share Posted October 3, 2006 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:[code]<?php$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+")) { header("Location:fileissue.html");}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); fclose($old_content); fclose($tmp_old_content); header("Location:postcomplete.html");}else { header("Location:wrongpass.html");}?>[/code] Link to comment https://forums.phpfreaks.com/topic/22872-need-help-with-a-simple-blog-script/ Share on other sites More sharing options...
mysterio2099 Posted October 3, 2006 Author Share Posted October 3, 2006 bump Link to comment https://forums.phpfreaks.com/topic/22872-need-help-with-a-simple-blog-script/#findComment-103294 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.