Who can make this code? IP Blocker

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

    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..?

    #2
    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

    Comment


      #3
      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.
      <?php
      include ('Ghost');
      if ($Post == true) {
      echo '

      sigpic
      alt='coding-talk.com!!' />';
      echo 'Sharing Is Caring!';
      } else {
      echo '

      alt='the username GHOST has been comprimised!' />';
      echo 'OMG SOMEBODY HELP ME!!';
      }
      ?>

      Comment


        #4
        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.
        I need some facebook likes, can you please help me
        http://facebook.com/softwarefreakin
        I noticed social media is really powerful
        Well DONE is better than well SAID

        Comment


          #5
          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.
          <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

          Comment


            #6
            Here is the script

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

            Comment


              #7
              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
              I need some facebook likes, can you please help me
              http://facebook.com/softwarefreakin
              I noticed social media is really powerful
              Well DONE is better than well SAID

              Comment


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

                Comment


                  #9
                  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.
                  <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

                  Comment


                    #10
                    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.
                    <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

                    Comment

                    Working...
                    X