Jump to content

mysterio2099

Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mysterio2099's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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]
×
×
  • Create New...

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.