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 6 of 6

Thread: Time Limit

  1. #1
    Join Date
    Aug 2006
    Posts
    282
    Tokens
    0

    Default Time Limit

    PHP Code:
    <?php

    $name 
    $_POST['name'];
    $message $_POST['message'];
    $IP $_SERVER['REMOTE_ADDR'];

    if(empty(
    $name) OR empty($message))
    {
    echo 
    "

    <script language='javascript'>

    alert('You forgot to fill in one or more form fields...');

    </script>
    "
    ;

    }
    else
    {

    $name htmlspecialchars($name);
    $message htmlspecialchars($message);
    $shout = ("<font size=\"1\" face=\"Verdana\">
    <b>
    $name</b>; $message<br><br>");

    $read fopen("textfiles/messages.txt""r");
    $contents fread($readfilesize('textfiles/messages.txt'));
    fclose($read);

    $write fopen("textfiles/messages.txt""w");
    fwrite($write"$shout $contents");
    fclose($write);

    }
    print 
    "<meta http-equiv=\"refresh\" content=\"0;shoutbox.php\">";

    ?>
    How do i make it so each unique user can only post once every 15 seconds?

    Correctable (Forum Moderator) - Thread moved to Coding. Please post in the correct section.
    Last edited by lMattz; 10-08-2006 at 09:35 PM.

  2. #2
    Join Date
    Jun 2006
    Location
    London!
    Posts
    616
    Tokens
    0

    Default

    Dude this is like your 40th thread on your shoutbox, dude just make ONE thread called Drug needs help with shoutbox ;D
    Then update there.















    :

  3. #3
    Join Date
    Aug 2006
    Posts
    282
    Tokens
    0

    Default

    Nah, lmao.

  4. #4
    Join Date
    Jun 2006
    Location
    London!
    Posts
    616
    Tokens
    0

    Default

    Lmao
    But most of them are like Shoutbox or Help!11one
    So yeah *bumpage*















    :

  5. #5
    Join Date
    Sep 2005
    Posts
    1,604
    Tokens
    0

    Latest Awards:

    Default

    Is that the admin addtag or the normal one?

  6. #6
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    An easy option would be to set a cookie which expires 15 seconds after being set, and each time the script is ran check if the cookie is set (and if it is, exit the script.) However, if someone were to clear their cookies or not have cookies enabled the script wont work.

    PHP Code:
    if(isset($_COOKIE[postTime])) {

      print 
    "<script type='text/JavaScript'>\n";
      
    printf("      alert('You cannot post more than once in 15 seconds, please wait %s seconds before 

    posting again.');\n"
    ,
            (
    15-(time()-$_COOKIE[postTime])));
      print 
    "</script>";

      exit();

    }

    setcookie('postTime'time(), time()+15); 
    *I haven't tested that script*

    I could create a script which uses MySQL, where it stops an IP address accessing the post page more than once in 15 seconds (if you feel this isn't enough protection.)
    kinda quit.

Posting Permissions

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