Very Cool Script - I Can't Figure it Out!

Discussion in 'PHP' started by successfirst, Nov 21, 2007.

  1. #1
    Hello everyone,

    I just found a web site running a really cool script but I can't figure out how they do it. :confused:

    The script is located at http://www.smalltime.com/Anonymous

    Can someone help me figure out how it is coded? I'm "OK" with PHP but could be a lot better. Know what I mean? :)

    Thanks for your help!

    Brandon
     
    successfirst, Nov 21, 2007 IP
  2. tamen

    tamen Peon

    Messages:
    182
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    When someone writes a message. Get the contents of message.txt and show it to the one who submitted the new message, then replace the old message with the new message.

    As simple as that.
     
    tamen, Nov 21, 2007 IP
  3. the_j0ker

    the_j0ker Peon

    Messages:
    92
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Setup a database with one table "MESSAGES", which contains one entry with one field "message".

    Upon submission of a message:
    1. Get the (only) entry from the database and save in a variable
    2. Take the submitted message and save it over the only entry in the database
    3. Display the variable on the screen

    For statistics or tracking you could alternatively have 3 fields in the DB table "messages" : "id" (auto-increment), "message", "date".

    Upon submission of a message:
    1. Get the last entry (most recent date, or highest id) and save in a var
    2. Save the submitted message in the DB
    3. Display the var from step 1

    This way you save all messages that have ever been submitted. This can grow pretty big, pretty fast if the site is popular :cool:
     
    the_j0ker, Nov 21, 2007 IP