WordPress plugin intelligence profile

IP-to-Country

Provide a simple interface for plugin authors to determine, in which country an IP is located.

WP PlugIndex snapshot

Current directory snapshot

Tested up to WordPress 3.0
Current version0.08
WordPress coverageTested up to WordPress 3.0
Minimum stackWP 2.8.0 · PHP —
Directory statusactive
Last directory update24 Jun 201412y ago
Active installations10Adoption metric — not a quality score
WordPress.org rating3.0 / 5 from 1 ratings
Official packageDirect from WordPress.org

Repository metrics are context, not quality scores. Active installations measure adoption and can strongly reflect a plugin’s age and historical popularity. Ratings, recent updates and “Tested up to” metadata also do not guarantee modern code, error-free operation, security, feature completeness or suitability for a particular site. Why active installs don’t tell the whole story →

WP PlugIndex currently records IP-to-Country version 0.08 as active, updated 12y ago and tested up to WordPress 3.0.

Overview

About this plugin

IP-to-Country is a plugin which doesn’t provide any output to users, but which

may be used by plugin authors to quickly and easily find, in which country an

IP address is located.

info

net/geo-ip/ (both IPv4 and IPv6).

Other sources are possible as long as they have the same format: CSV file,

fields enclosed with quotes (“) and separated with comma (,), lines ending

with LF (\n). Five columns:

  • Lower bound of an IP range.
  • Upper bound of an IP range. Both are represented as one 32-bit integer number,

such as you can get by using funtion ip2long().

  • 2-character country code
  • 3-character country code
  • Country name

Note: In order to import IPv6 addresses, IPv4 must be imported first. The

reason is, IPv6 database does not carry the full country information with

it, while the IPv4 database does.

Operations:

-

To detect if IP-to-Country plugin is installed:

$ip2c_available = class_exists(‘PepakIpToCountry’);

-

To find information about a numeric IP address:

8’);

// returns ‘UNITED STATES’

8’);

8’);

// both return ‘US’

8’);

// returns ‘USA’

8’);

// returns Array(‘iso_name’=>’UNITED STATES’, ‘iso_code2’=>’US’, ‘iso_code3’=>’USA’)

8’);

// returns ”

You may leave the IP address empty; in that case, IP address of currently

active user is used instead.

Note: All requests are cached, so there shouldn’t be a noticeable difference

between reading IP_to_Country_Info and reading all three pieces of information

separately using the _Full, _XX and _XXX functions.

-

To interface your plugin’s tables to IP-to-Country plugin’s tables within SQL,

a function Subselect is published:

$subselect = PepakIpToCountry::Subselect($ip, $countryfield);

  • $ip is a field that contains IP address in the form of one 32bit number, e.g.
  • If you store IP addresses in the usual form of four dot-separated

1’), you can use MySQL’s function INET_ATON:

$ip = ‘INET_ATON(my_ip_address_field)’;

It is strongly recommended to use qualified field names (with tablename in

front, separated by a dot):

ip_address)’;

  • $countryfield is the field you want returned. It can be one of the following:

iso_name – returns the same string as PepakIpToCountry::IP_to_Country_Full(…)

iso_code2 – returns the same string as PepakIpToCountry::IP_to_Country_XX(…)

iso_code3 – returns the same string as PepakIpToCountry::IP_to_Country_XX(…)

Note: No checking or validation is done on either of these parameters. It is assumed

they are field names, NOT strings. DO NOT EVER USE VALUES THAT YOUR USERS CAN

INFLUENCE! This is important! If you let users supply arguments to Subselect(), you

are letting them to do whatever they like with your database!

This function only works with IPv4 addresses.

Example usage:

if (class_exists(‘PepakIpToCountry’))

ip_addr)”, ‘iso_code2’);

else

$field = ‘NULL’;

*, ${field} country_code FROM ${wpdb->prefix}banlist b WHERE …”;

Note: This plugin requires PHP5. If you want it to work with ZIP files

g. for updating IP-country info from the default location), your PHP

must have extension php_zip enabled.

WordPress.org metadata

Plugin tags

Topics listed for this plugin in the WordPress.org directory.

  • ip to country
  • geolocation
  • invisible
Compatibility & maintenance

Compatibility & maintenance

Tested up to WordPress 3.0

Not yet marked as tested with WordPress 7.1. WordPress.org currently lists Tested up to 3.0.

Current WordPress releaseWordPress 7.1
WordPress.org Tested up to3.0
Minimum requirementsWordPress 2.8.0 · PHP not listed
Update activity24 Jun 201412y ago

“Tested up to” is directory metadata supplied by the plugin author. WP PlugIndex does not turn an older declaration into a claim that the plugin is incompatible.

Changes recorded by WP PlugIndex

Recent tracked changes

No tracked version or compatibility changes have been recorded by WP PlugIndex yet.

Tracking & source

WP PlugIndex tracks public WordPress.org directory metadata and records selected version, compatibility and availability changes as they are detected.

Plugin watchlist

Watch this plugin

Sign in to your WP PlugIndex account or create a free account. Free accounts can watch up to 5 plugins and see what changed.

Watch limit

Watchlist limit reached

You have reached your current active watch limit.