geo/srcGeoIP.php

geoip.inc

Copyright (C) 2007 MaxMind LLC

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Classes

GeoIP

Constants

GEOIP_COUNTRY_BEGIN

GEOIP_COUNTRY_BEGIN = 16776960

Modified by Loic d'Anterroches to have the function names with the right case GeoIP instead of geoip.

Added GeoIP_countryOfRequest function. Using single quotes instead of double.

Downloaded 2007-11-26.

GEOIP_STATE_BEGIN_REV0

GEOIP_STATE_BEGIN_REV0 = 16700000

GEOIP_STATE_BEGIN_REV1

GEOIP_STATE_BEGIN_REV1 = 16000000

GEOIP_STANDARD

GEOIP_STANDARD = 0

GEOIP_MEMORY_CACHE

GEOIP_MEMORY_CACHE = 1

GEOIP_SHARED_MEMORY

GEOIP_SHARED_MEMORY = 2

STRUCTURE_INFO_MAX_SIZE

STRUCTURE_INFO_MAX_SIZE = 20

DATABASE_INFO_MAX_SIZE

DATABASE_INFO_MAX_SIZE = 100

GEOIP_COUNTRY_EDITION

GEOIP_COUNTRY_EDITION = 106

GEOIP_PROXY_EDITION

GEOIP_PROXY_EDITION = 8

GEOIP_ASNUM_EDITION

GEOIP_ASNUM_EDITION = 9

GEOIP_NETSPEED_EDITION

GEOIP_NETSPEED_EDITION = 10

GEOIP_REGION_EDITION_REV0

GEOIP_REGION_EDITION_REV0 = 112

GEOIP_REGION_EDITION_REV1

GEOIP_REGION_EDITION_REV1 = 3

GEOIP_CITY_EDITION_REV0

GEOIP_CITY_EDITION_REV0 = 111

GEOIP_CITY_EDITION_REV1

GEOIP_CITY_EDITION_REV1 = 2

GEOIP_ORG_EDITION

GEOIP_ORG_EDITION = 110

GEOIP_ISP_EDITION

GEOIP_ISP_EDITION = 4

SEGMENT_RECORD_LENGTH

SEGMENT_RECORD_LENGTH = 3

STANDARD_RECORD_LENGTH

STANDARD_RECORD_LENGTH = 3

ORG_RECORD_LENGTH

ORG_RECORD_LENGTH = 4

MAX_RECORD_LENGTH

MAX_RECORD_LENGTH = 4

MAX_ORG_RECORD_LENGTH

MAX_ORG_RECORD_LENGTH = 300

GEOIP_SHM_KEY

GEOIP_SHM_KEY = 1329681409

US_OFFSET

US_OFFSET = 1

CANADA_OFFSET

CANADA_OFFSET = 677

WORLD_OFFSET

WORLD_OFFSET = 1353

FIPS_RANGE

FIPS_RANGE = 360

GEOIP_UNKNOWN_SPEED

GEOIP_UNKNOWN_SPEED = 0

GEOIP_DIALUP_SPEED

GEOIP_DIALUP_SPEED = 1

GEOIP_CABLEDSL_SPEED

GEOIP_CABLEDSL_SPEED = 2

GEOIP_CORPORATE_SPEED

GEOIP_CORPORATE_SPEED = 3

Functions

GeoIP_load_shared_mem()

GeoIP_load_shared_mem(  $file) 

Parameters

$file

_setup_segments()

_setup_segments(  $gi) 

Parameters

$gi

GeoIP_open()

GeoIP_open(  $filename,   $flags) 

Parameters

$filename
$flags

GeoIP_close()

GeoIP_close(  $gi) 

Parameters

$gi

GeoIP_country_id_by_name()

GeoIP_country_id_by_name(  $gi,   $name) 

Parameters

$gi
$name

GeoIP_country_code_by_name()

GeoIP_country_code_by_name(  $gi,   $name) 

Parameters

$gi
$name

GeoIP_country_name_by_name()

GeoIP_country_name_by_name(  $gi,   $name) 

Parameters

$gi
$name

GeoIP_country_id_by_addr()

GeoIP_country_id_by_addr(  $gi,   $addr) 

Parameters

$gi
$addr

GeoIP_country_code_by_addr()

GeoIP_country_code_by_addr(  $gi,   $addr) 

Parameters

$gi
$addr

GeoIP_country_name_by_addr()

GeoIP_country_name_by_addr(  $gi,   $addr) 

Parameters

$gi
$addr

_GeoIP_seek_country()

_GeoIP_seek_country(  $gi,   $ipnum) 

Parameters

$gi
$ipnum

_get_org()

_get_org(  $gi,   $ipnum) 

Parameters

$gi
$ipnum

GeoIP_org_by_addr()

GeoIP_org_by_addr(  $gi,   $addr) 

Parameters

$gi
$addr

_get_region()

_get_region(  $gi,   $ipnum) 

Parameters

$gi
$ipnum

GeoIP_region_by_addr()

GeoIP_region_by_addr(  $gi,   $addr) 

Parameters

$gi
$addr

GeoIP_getdnsattributes()

GeoIP_getdnsattributes(  $l,   $ip) 

Parameters

$l
$ip

GeoIP_countryOfRequest()

GeoIP_countryOfRequest(  $request,   $geoipdb) : string

Return the 2 character code of the country given the request object.

Parameters

$request
$geoipdb

Returns

string —

2 character ISO code