You are here

function smart_ip_get_ip_address_version in Smart IP 6.2

Same name and namespace in other branches
  1. 7.2 smart_ip.module \smart_ip_get_ip_address_version()

Determine IP address version.

1 call to smart_ip_get_ip_address_version()
smart_ip_get_location in ./smart_ip.module
Get the geo location from the IP address

File

./smart_ip.module, line 1542
Determines country, geo location (longitude/latitude), region, city and postal code of the user, based on IP address

Code

function smart_ip_get_ip_address_version($ip_address) {
  if (filter_var($ip_address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
    return 4;
  }
  elseif (filter_var($ip_address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
    return 6;
  }
}