Jump to content


Photo

Need help with a simple blog script


  • Please log in to reply
1 reply to this topic

#1 mysterio2099

mysterio2099
  • Members
  • Pip
  • Newbie
  • 2 posts

Posted 03 October 2006 - 01:20 PM

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:

<?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");
}
?>


#2 mysterio2099

mysterio2099
  • Members
  • Pip
  • Newbie
  • 2 posts

Posted 03 October 2006 - 07:05 PM

bump




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users