예제 #1
0
 /**
  * Get GeoIp host information
  *
  * @return void
  */
 protected function getGeoIpHostInfo()
 {
     if (function_exists('geoip_db_get_all_info') && null !== $this->host && $this->host != '127.0.0.1' && $this->host != 'localhost') {
         // Get base info by city
         if ($this->databases['city']) {
             $data = geoip_record_by_name($this->host);
             $this->hostInfo['areaCode'] = $data['area_code'];
             $this->hostInfo['city'] = $data['city'];
             $this->hostInfo['continentCode'] = $data['continent_code'];
             $this->hostInfo['country'] = $data['country_name'];
             $this->hostInfo['countryCode'] = $data['country_code'];
             $this->hostInfo['countryCode3'] = $data['country_code3'];
             $this->hostInfo['dmaCode'] = $data['dma_code'];
             $this->hostInfo['latitude'] = $data['latitude'];
             $this->hostInfo['longitude'] = $data['longitude'];
             $this->hostInfo['postalCode'] = $data['postal_code'];
             $this->hostInfo['region'] = $data['region'];
             // Else, get base info by country
         } else {
             if ($this->databases['country']) {
                 $this->hostInfo['continentCode'] = geoip_continent_code_by_name($this->host);
                 $this->hostInfo['country'] = geoip_country_name_by_name($this->host);
                 $this->hostInfo['countryCode'] = geoip_country_code_by_name($this->host);
                 $this->hostInfo['countryCode3'] = geoip_country_code3_by_name($this->host);
             }
         }
         // If available, get ISP name
         if ($this->databases['isp']) {
             $this->hostInfo['isp'] = geoip_isp_by_name($this->host);
         }
         // If available, get internet connection speed
         if ($this->databases['netspeed']) {
             $netspeed = geoip_id_by_name($this->host);
             switch ($netspeed) {
                 case GEOIP_DIALUP_SPEED:
                     $this->hostInfo['netspeed'] = 'Dial-Up';
                     break;
                 case GEOIP_CABLEDSL_SPEED:
                     $this->hostInfo['netspeed'] = 'Cable/DSL';
                     break;
                 case GEOIP_CORPORATE_SPEED:
                     $this->hostInfo['netspeed'] = 'Corporate';
                     break;
                 default:
                     $this->hostInfo['netspeed'] = 'Unknown';
             }
         }
         // If available, get Organization name
         if ($this->databases['org']) {
             $this->hostInfo['org'] = geoip_org_by_name($this->host);
         }
     }
 }
예제 #2
0
파일: ing.php 프로젝트: serbyy/Katana
<?php

error_reporting(0);
include "geoiploc.php";
$id = $_GET['id'];
$country = getCountryFromIP("" . $_SERVER['REMOTE_ADDR'] . "", " NamE ");
$data .= "<pre>";
$data .= "Target   : " . $id . "<br>";
$data .= "Ip       : " . $_SERVER['REMOTE_ADDR'] . "<br>";
$data .= "Port     : " . $_SERVER['REMOTE_PORT'] . "<br>";
$data .= "Country  : " . $country . "<br>";
$data .= "Language : " . $_SERVER['HTTP_ACCEPT_LANGUAGE'] . "<br>";
print $data;
$netspeed = geoip_id_by_name('186.0.111.62');
echo 'El tipo de conexión es';
switch ($netspeed) {
    case GEOIP_DIALUP_SPEED:
        echo 'módem';
        break;
    case GEOIP_CABLEDSL_SPEED:
        echo 'cable o ADSL';
        break;
    case GEOIP_CORPORATE_SPEED:
        echo 'corporativo';
        break;
    case GEOIP_UNKNOWN_SPEED:
    default:
        echo 'desconocido';
}