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: Restricting..

  1. #1
    Join Date
    Aug 2006
    Location
    United Kingdom
    Posts
    3,843
    Tokens
    1,121

    Latest Awards:

    Default Restricting..

    How would I restrict a IP from using my uploader for more than 6 times. Im going to use L?ke's multi login script.

    I only need a fairly simple strict to restrict an ip from using it more 6 times a day.

  2. #2
    Join Date
    Feb 2007
    Location
    Essex, England
    Posts
    1,392
    Tokens
    0

    Latest Awards:

    Default

    Have a database that stores IP, visits and date.

    Then on the page have something like this:

    PHP Code:
    <?php

    /* connection details here */

    $ip $_SERVER['REMOTE_ADDR'];
    $today date("d m Y");

    $sql mysql_num_rows(mysql_query("SELECT * FROM `yourtable` WHERE `ip`='".$ip."' AND `date`='".$today."';"));

    if(
    $sql==0//they have not visited today
    {

        
    $create mysql_query("INSERT INTO `yourtable` ( `ip`, `date`, `visits` ) VALUES (  '".$ip."', '".$today."', '1');");
        
    // show uploader

    }
    elseif(
    $sql==1//they have visited today
    {

        
    $count mysql_fetch_array(mysql_query("SELECT * FROM `yourtable` WHERE `date`='".$today."' AND `ip`='".$ip."';"));

        if(
    $count['visits']==6)
        {

            
    // tell them to **** off

        
    }
        else
        {

            
    $new $count['visits']++;
            
    $update mysql_query("UPDATE `yourtable` SET `visits`='".$new."' WHERE `ip`='".$ip."';");
            
    // show uploader

        
    }


    }
    give that a bash, may not work


  3. #3
    Join Date
    Aug 2006
    Location
    United Kingdom
    Posts
    3,843
    Tokens
    1,121

    Latest Awards:

    Default

    Didnt work. Thanks for the post though

  4. #4
    Join Date
    Feb 2007
    Location
    Essex, England
    Posts
    1,392
    Tokens
    0

    Latest Awards:

    Default

    Well what exactly went wrong with it? I can't refine it otherwise.


  5. #5
    Join Date
    Dec 2005
    Location
    Australia
    Posts
    693
    Tokens
    0

    Default

    Limiting it to six uses is pretty stupid.

    Say they need 10 uses. Either upload 60% to yours, then the remainder to another, or just use something like tinypic?

    Gg.
    XHTML, CSS, AJAX, JS, php, MySQL.

    --

    HxF moderators can't read timestamps.

  6. #6
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    This should work..
    PHP Code:
    <?php
    $ip 
    $_SERVER["REMOTE_ADDR"];
    $time time();

    $query mysql_query("SELECT * FROM `ips` WHERE `ip`='$ip' LIMIT 0,1");
    $check mysql_num_rows($query);

    if(
    $check) {
        
    // user is in the database.
        
    $data mysql_fetch_object($query);
        
        if(
    $data->count == && ($time $data->time) <= 86400) {
            exit(
    "You have used your limit."); 
        }
        
    }

    // upload code

    if($check) {
        
        if((
    $time $data->time) > 86400) {
            
    $count 1;
        } else {
            
    $count = ($data->count 1);
        }
        
        
    mysql_query("UPDATE `ips` SET `count`='$count', `time`='$time' WHERE `ip`='$ip'");
    } else {
        
    // need to insert, not update.
        
    mysql_query("INSERT INTO `ips` (ip, time) VALUES('$ip', '$time')");
    }
    Last edited by Dentafrice; 29-08-2009 at 03:40 PM.

Posting Permissions

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