function _ip2country_lookup in IP-based Determination of a Visitor's Country 6
Same name and namespace in other branches
- 5 uc_ip2country.module \_ip2country_lookup()
- 7 ip2country.admin.inc \_ip2country_lookup()
AJAX callback to lookup an IP address in the database.
Parameters
$arg: String with IP address.
Return value
JSON object for display by jQuery script.
1 string reference to '_ip2country_lookup'
- ip2country_menu in ./
ip2country.module - Implements hook_menu().
File
- ./
ip2country.admin.inc, line 79 - Determination of user's Country based on IP address.
Code
function _ip2country_lookup($arg) {
// Return results of manual lookup.
$country = ip2country_get_country($arg);
if ($country) {
print drupal_to_js(array(
'message' => t('IP Address @ip is assigned to @country.', array(
'@ip' => $arg,
'@country' => $country,
)),
));
}
else {
print drupal_to_js(array(
'message' => t('IP Address @ip is not assigned to a country.', array(
'@ip' => $arg,
)),
));
}
exit;
}