Ip2country Accurate Script

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

    #16
    try to be satisfied

    here are some scripts regarding to ip2country and ip2location
    Code:
    http://rapidshare.com/files/59338807/ip2country.rar
    Code:
    http://rapidshare.com/files/60043818/IP2Loc.rar
    Code:
    http://rapidshare.com/files/29230733/IP2LOCATION.IP-Country-Region-City-Latitude-Longitude.Database-JB.rar
    [/b]

    Comment


      #17
      try this one
      Code:
      http://software77.net/cgi-bin/ip-country/geo-ip.pl?action=download
      Code:
      <?php
      
      // Get the surfer&#39;s ip address
      $addr = $usip;
      echo "Your IP, IPv4: " . $addr . "
      \n";
      
      $ip = sprintf("%010u", ip2long($addr));
      echo "Your IP, numerical: " . $ip . "
      \n";
      
      // Initiate the timer
      $time_start = microtime_float();
      
      // Open the csv file for reading
      $handle = fopen("IpToCountry.csv", "r");
      
      // Load array with start ips
      $row = 1;
      while (($buffer = fgets($handle, 4096)) !== FALSE) {
        $array[$row] = $buffer;
        $row++;
      }
      
      // Time loading
      $time_end = microtime_float();
      $time = substr($time_end - $time_start, 0, 7);
      //echo "Array with " . $row . " start ips loaded in $time seconds
      
      \n";
      
      // Locate the row with our ip using bisection
      $row_lower = &#39;0&#39;;
      $row_upper = $row;
      while (($row_upper - $row_lower) > 1) {
        $row_midpt = (int) (($row_upper + $row_lower) / 2);
        $buffer = $array[$row_midpt];
        $start_ip = sprintf("%010u", substr($buffer, 1, strpos($buffer, ",") - 1));
        if ($ip >= $start_ip) {
          $row_lower = $row_midpt;
        } else {
          $row_upper = $row_midpt;
        }
      }
      
      // Time locating
      $time_end = microtime_float();
      $time = substr($time_end - $time_start, 0, 7);
      //echo "Row with your ip (# " . $row_lower . ") located after $time seconds
      
      \n";
      
      // Read the row with our ip
      $buffer = $array[$row_lower];
      $buffer = str_replace("\"", "", $buffer);
      $ipdata = explode(",", $buffer);
      //echo "Data retrieved from the csv file:
      \n";
      //echo "ipstart = " . sprintf("%010u", $ipdata[0]) . "
      \n";
      //echo "ipend = " . sprintf("%010u", $ipdata[1]) . "
      \n";
      //echo "registry = " . $ipdata[2] . "
      \n";
      //echo "assigned = " . date(&#39;j.n.Y&#39;, $ipdata[3]) . "
      \n";
      //echo "iso2 = " . $ipdata[4] . "
      \n";
      //echo "iso3 = " . $ipdata[5] . "
      \n";
      echo "country : " . $ipdata[6] . "
      \n";
      echo &#39;Country flag : [img]ip_flags/&#39;.($ipdata[4]).&#39;.gif[/img]
      &#39;;
      
      // Close the csv file
      fclose($handle);
      
      // Total execution time
      $time_end = microtime_float();
      $time = substr($time_end - $time_start, 0, 7);
      //echo "Executing the whole script took $time seconds\n";
      
      function microtime_float()
      {
         list($usec, $sec) = explode(" ", microtime());
         return ((float)$usec + (float)$sec);
      }
      
      ?>

      Comment


        #18
        I have try to add at my lavalair but not work
        if like my post click:

        http://coding-talk.com/images/totall...ost_thanks.gif

        Comment


          #19
          I have try to add at my lavalair but not work [/b]

          its workin. you might want to check the dump file if if the ip you use when you view someones profile exist. or you might want to upload some image like a question mark in flags folder and try this:

          <div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>$uipadd = mysql_fetch_array(mysql_query("SELECT ipadd FROM ibwf_users WHERE id=&#39;".$who."&#39;"));
          $pro_flag = network($uipadd[0],1);
          if ($pro_flag == "")
          {
          $pro_flag = "";
          }
          echo "ISP:$pro_flag
          ";</div>
          so if ever ip does not exist in dump file, it will return a question mark image. the only problem im having with this is when i put it in online list. i only want to display the mini flags beside the name the of the user but it only shows blank. anyone had sorted it out or someone want to help?

          Comment

          Working...
          X