function geoip_ip_address in GeoIP API 7.2
Same name and namespace in other branches
- 5 geoip.module \geoip_ip_address()
- 6 geoip.module \geoip_ip_address()
- 7 geoip.module \geoip_ip_address()
Helper function to get the current ip address.
Uses ip_address() internally to resolve HTTP_X_FORWARDED_FOR headers. If debugging is enabled you can define a ip using the GET parameter geoip_debug.
Return value
string The ip address.
See also
9 calls to geoip_ip_address()
- geoip_admin_settings in ./
geoip.admin.inc - Menu callback and form builder for admin/settings/geoip.
- geoip_city_name in ./
geoip.module - Returns the city data for a given IP.
- geoip_continent_code in ./
geoip.module - Returns the continent code for a given IP.
- geoip_continent_name in ./
geoip.module - Returns the continent name for a given IP.
- geoip_country_code in ./
geoip.module - Returns the ISO 3166-2 country code for a given IP.
File
- ./
geoip.module, line 35 - API for using the MaxMind GeoLite Country database.
Code
function geoip_ip_address() {
if (variable_get('geoip_debug', FALSE) && isset($_GET['geoip_debug'])) {
$ip = check_plain($_GET['geoip_debug']);
drupal_set_message(t('GeoIP debug mode. Using IP: %ip', array(
'%ip' => $ip,
)), 'status', FALSE);
}
else {
$ip = ip_address();
}
return $ip;
}