function _ip2country_lookup in IP-based Determination of a Visitor's Country 5
Same name and namespace in other branches
- 6 ip2country.admin.inc \_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'
- uc_ip2country_menu in ./
uc_ip2country.module - Implementation of hook_menu().
File
- ./
uc_ip2country.module, line 207 - Determination of user's Country based on IP
Code
function _ip2country_lookup($arg) {
// Return results of manual lookup
$country = uc_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;
}