Writing a saybox script, need help with posting

Discussion in 'PHP' started by Faltzer, Apr 28, 2007.

  1. #1
    Alright, currently, I am writing up a saybox script, which is a really simple write-to-file-refresh-after-submit type of saybox.

    http://www.pokerindin.com/saybox/

    Is there any way to make new posts appear on top always?
     
    Faltzer, Apr 28, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    The link doesn't even work.
     
    nico_swd, Apr 28, 2007 IP
  3. Wyla

    Wyla Well-Known Member

    Messages:
    924
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    140
    #3
    Wyla, Apr 28, 2007 IP
  4. Faltzer

    Faltzer Peon

    Messages:
    39
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    My bad, go to

    pokerindin dot com slash projects slash saybox,

    then see what im discussing.
     
    Faltzer, Apr 29, 2007 IP
  5. Wyla

    Wyla Well-Known Member

    Messages:
    924
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    140
    #5
    Could we see the code?
     
    Wyla, Apr 30, 2007 IP
  6. Faltzer

    Faltzer Peon

    Messages:
    39
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Oh, sorry

    index.php
    
    <html>
    <head>
    <title>RindinTag</title>
    <meta http-equiv="refresh" content="5">
    <style>
    body{
    font-family: verdana;
    font-size: 10px;
    }
    
    #iframe {
    font-family: verdana;
    font-size: 10px;
    border: 1px solid black; 
    overflow-x: auto;
    width: 158px;
    height:270px;
    }
    
    </style>
    </head>
    <body>
    <iframe src="posts.php" style="font-family: verdana;
    font-size: 10px;
    border: 1px solid black; 
    overflow-x: auto;
    width: 158px;
    height:270px;">You need iframes enabled in order to view this chat box. Please download a browser that supports frames, such as <a href='http://www.firefox.com'>Mozilla Firefox</a>.</iframe>
    
    <form action="post.php" method="get">
    Name:<br />
    <input type="text" name="name"><br />
    Message:<br />
    <textarea name="message"></textarea><br />
    <input type="submit" value="Send Info">
    </form>
    </body>
    </html>
    
    Code (markup):
    post.php
    
    <html>
    <head>
    <title>RindinTag</title>
    <meta http-equiv="refresh" content="5; URL=index.php">
    </head>
    <body>
    <?php
    //include('config.php');
    $user = $_GET["name"];
    $message = $_GET["message"];
    //Submit Message
    print("Thank you, your tag has been posted. You will be redirected in 5 seconds.");
    $out = fopen("posts.php", "a");
    if (!$out) {
    print("Could not append to file");
    exit;
    }
    //Message Template
    fputs ($out,implode,("\n"));
    fwrite($out,"<b>$user</b><br />$message<br /><br />");
    fclose($out);
    ?>
    </body>
    </html>
    
    Code (markup):
    posts.php
    
    <html><head><style>
    body {
    font-family: verdana;
    font-size: 10px;
    overflow-x: auto;
    
    }
    </style>
    </head>
    <body>
    
    <b><a href='http://www.pokerindin.com'>Rindiny</a></b><br />Yay! Saybox is up!<br /><br />
    
    <b><a href=''>Faltzer</a></b><br />Cool<br /><br /><b>Rindiny</b><br />Testing<br /><br />
    
    
    
    </body>
    </html><b>Rindiny</b><br />Hrm, I wish I could find out how to place the newest post on top. :/;<br /><br /><b>hi</b><br />hi<br /><br /><b>twtwtw</b><br />\'\'test\'\'\'<br /><br /><b>\'\'hi</b><br />you need to use strip slashes on the message to stop \' happening<br /><br />
    
    Code (markup):
     
    Faltzer, May 5, 2007 IP