Feature: GeoIP Flags

Fixer's Avatar

Fixer

12 Oct, 2014 07:15 PM

Could You make Icon Flag (near IP or seperate column) by country from IP (geoip)?.
Important flags in attachment.

geoip like maxmind...
http://geoip3.maxmind.com/[a/b/f]?l=[LICENSE KEY]&i=[IP ADRESS]

Sample:
<?php
$licencja[1] = array('nr' => '1', 'typ' => 'e', 'klucz' => '[LICENSE KEY]', 'stan' => '0');
.
.
.
$licencja[10] = array('nr' => '10', 'typ' => 'a', 'klucz' => '[LICENSE KEY]', 'stan' => '1');

if ($licencja[$i]['typ'] == 'a') {
$geoip_kolumny = array(
'country_code',
'error'
);
}

# b - city
if ($licencja[$i]['typ'] == 'b') {
$geoip_kolumny = array(
'country_code',
'region_code',
'city_name',
'latitude',
'longitude',
'error'
);
}

# f - city/isp/org
if ($licencja[$i]['typ'] == 'f') {
$geoip_kolumny = array(
'country_code',
'region_code',
'city_name',
'postal_code',
'latitude',
'longitude',
'metro_code',
'area_code',
'isp_name',
'organization_name',
'error'
);
}

# e - omni
if ($licencja[$i]['typ'] == 'e') {
$geoip_kolumny = array(
'country_code',
'country_name',
'region_code',
'region_name',
'city_name',
'latitude',
'longitude',
'metro_code',
'area_code',
'time_zone',
'continent_code',
'postal_code',
'isp_name',
'organization_name',
'domain',
'as_number',
'netspeed',
'user_type',
'accuracy_radius',
'country_confidence',
'city_confidence',
'region_confidence',
'postal_confidence',
'error'
);
}

$maxmind_url = ('http://geoip3.maxmind.com/' . $licencja[$i]['typ'] . '?l=' . $licencja[$i]['klucz'] . '&i=' . $ban_ipv4);

                $curl = curl_init();
                curl_setopt_array($curl, array(
                    CURLOPT_URL => $maxmind_url,
                    CURLOPT_USERAGENT => 'MaxMind PHP Sample',
                    CURLOPT_TIMEOUT => 5,
                    CURLOPT_CONNECTTIMEOUT => 5,
                    CURLOPT_RETURNTRANSFER => true
                    )
                  );

                $resp = curl_exec($curl);

                if (curl_errno($curl)) {
                  echo ('Wystąpił błąd w funkcji pobierającej CURL().' . curl_errno($curl));
                  flush(); ob_flush();
                }
                $geoip_wartosci = str_getcsv(filtruj(str_replace("'", "\'", $resp)));
                $geoip_wartosci = array_pad($geoip_wartosci, sizeof($geoip_kolumny), '');
                $geoip = array_combine($geoip_kolumny, $geoip_wartosci);

?>

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • flags.zip 557 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac