Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2006
    Location
    London, England
    Posts
    696
    Tokens
    0

    Default A comment system w/o SQL

    Okay basically i made a php comment system without any databases it uses a text file to store data. Im learning so its pretty basic . Anyway here it is if you want to use it.



    First of all make a text file and name it what ever you want i named mine comments.txt but you can call it anything. Once you have made your text file CHMOD it to 0777.


    Next make a php file, once again you can name it whatever you like i chose to call it comment.php and copy + paste the code below:

    Code:
    <?
    $name = $_POST['name'];
    $message = $_POST['message'];
    @ $fp = fopen($_SERVER['DOCUMENT_ROOT'] . "/comments.txt", 'a');
    if (!$fp)
    {
    echo "There was an error! Try again later!"; 
    exit;
    }
    else
    {
    $outputstring = "<strong>Name:</strong> " . $name ."<br><strong> Comment:</strong>  " . $message .";
    fwrite($fp, $outputstring, strlen($outputstring));
    fclose($fp);
    echo "Your post was successful. Click <a href='index.php'>here</a> to continue.";
    } 
    ?>
    Next make another PHP file here i named it index.php as this will be the main page which displays the comments & the form, alternatively you can rename it if you wish.

    Code:
    <html>
    <head>
    <title>Comment</title>
    </head>
    <body>
    <?php include("comments.txt"); ?> //This is where your comments will be displayed
    <hr style="border: 1px solid #000000;">
    <form action="comment.php" method="post">
    <center><table>
    <fieldset>
    <legend>Name</legend>
    <input type="text" name="name">
    </fieldset>
    <fieldset>
    <legend>Message</legend>
    <textarea name="message"></textarea>
    </fieldset>
    <input class="button" type="submit" value="submit">
    </table></center>
    </form>
    </body>
    </html>
    Thats all there is to it really
    Last edited by DUB; 10-02-2008 at 12:59 AM.
    ;veni vidi vici
    ;i came, i saw, i ownt

  2. #2
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    4,753
    Tokens
    1,860
    Habbo
    ,Alpha,

    Latest Awards:

    Default

    Hey +Rep That Will Help People Who Need One Is There No ADMIN Section Where You Can Manage Comments? Or Is That Done By editing comments.txt ?

    Nice Though Well Done

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •