Who can make this code? IP Blocker

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • arnage
    replied
    Try this.

    Code:
    CREATE TABLE `logs` (
    	`id` bigint(1000000) NOT NULL auto_increment,
    	`ip` varchar(15) NOT NULL,
    	`time` int(10) NOT NULL,
    PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
    PHP Code:
    $where ''// Where to redirect
    $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';

    if (!empty(
    $ip)) {

        
    $time24 = (time() - (24 60 60));

        
    $check mysql_query('SELECT COUNT(*) FROM `logs` WHERE `ip` = "'.$ip.'" AND `time` < '.$time24.'');
        if (!
    mysql_num_rows($check)) {

            @
    mysql_query('INSERT INTO `logs` VALUES (\'\', "'.$ip.'", "'.time().'")');


            
    // The rest of page goes here...


        
    } else {

            
    $select mysql_query('SELECT `id` FROM `logs` WHERE `time` > '.$time24.'');
            if (
    mysql_num_rows($select)) {
                while (
    $sel mysql_fetch_array($select)) {

                    @
    mysql_query('DELETE FROM `logs` WHERE `id` = '.$sel[0].'');
        
                }
            }

            
    header('Location: '.$where.'');
            exit;

        }
    } else {

        exit(
    'No IP...');


    ... or:

    PHP Code:
    function logs() {

    $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';

    if (!empty(
    $ip)) {

        
    $time24 = (time() - (24 60 60));

        
    $check mysql_query('SELECT COUNT(*) FROM `logs` WHERE `ip` = "'.$ip.'" AND `time` < '.$time24.'');
        if (!
    mysql_num_rows($check)) {

            @
    mysql_query('INSERT INTO `logs` VALUES (\'\', "'.$ip.'", "'.time().'")');

            return 
    false;

        } else {

            
    $select mysql_query('SELECT `id` FROM `logs` WHERE `time` > '.$time24.'');
            if (
    mysql_num_rows($select)) {
                while (
    $sel mysql_fetch_array($select)) {

                    @
    mysql_query('DELETE FROM `logs` WHERE `id` = '.$sel[0].'');
        
                }
            }

            return 
    true;

        }
    } else {

        return 
    true;

    }
    }

    //

    if (logs())
        
    header('Location: http://google.com/');
        exit; 
    If someone have a better idea please post.
    Last edited by arnage; 07.10.12, 08:45.

    Leave a comment:


  • arnage
    replied
    Originally posted by Lue_chin View Post
    Hello mr i made it you can try here and want to buy pm me
    One ip one click
    This is just dumb. I'll not delete it because its the reason why this person should never get any help here anymore, even he got it alot.

    Leave a comment:


  • Rksk
    replied
    using IP to verify unique users is a very very old trick.
    Just use cookies. But It too can cheat.

    Leave a comment:


  • softwarefreak
    replied
    Originally posted by Lue_chin View Post
    Hello mr i made it you can try here and want to buy pm me
    One ip one click
    It's cool, But the problem is, a person can make 1000 clicks in 24 hours :P by using the intelligent part of his brain

    Leave a comment:


  • Lue_chin
    replied
    Here is the script

    Hello mr i made it you can try here and want to buy pm me
    One ip one click

    Leave a comment:


  • arnage
    replied
    Set tables for ip and time, do mysql_num_rows() with query $var = time() - (24 * 60 * 60), if there is send header Location, if not do wath you want with that, and at the end set query to delete stored ip older than 24h.

    Leave a comment:


  • softwarefreak
    replied
    Tracking/blocking with IP is not a good option, most of us have dynamic external IP's , it changes whenever you disconnect & then reconnect, cookie is a better option.

    Leave a comment:


  • Ghost
    replied
    why does he need to inbox you.
    if you can really make it. then why not
    just make it and post here in the thread
    where he asked for it. this way other people
    have the chance to either use yours or add
    another code attempt of it so he has more than
    one option to choose from.

    Leave a comment:


  • Hammad
    replied
    Originally posted by Newfine View Post
    How to store visitors ip in database and recall it >> if they visit again with same ip they redirect to home page>> and this ip should delete from database in 24hrs..
    can anyone try to make this code..?
    You simply Want to Make Anti Cheat script, If not Use cookie instead saving ip in database

    Leave a comment:


  • Newfine
    started a topic Who can make this code? IP Blocker

    Who can make this code? IP Blocker

    How to store visitors ip in database and recall it >> if they visit again with same ip they redirect to home page>> and this ip should delete from database in 24hrs..
    can anyone try to make this code..?
Working...
X