= 16 && $OctOrHextets[1] <= 32)) ) { die('Invalid IPv4 address.'); } foreach($OctOrHextets as $Octet) { if ($Octet > 255 || $Octet < 0) { die('Invalid IPv4 address.'); } } } else if (sizeof($OctOrHextets) <= 8) { // IPv6 foreach($OctOrHextets as $Hextet) { if (strlen($Hextet) > 4) { die('Invalid IPv6 address.'); } } } else { die('Invalid IP address.'); } $Host = Tools::lookup_ip($IP); if ($Host === '') { trigger_error('Tools::get_host_by_ajax() command failed with no output, ensure that the host command exists on your system and accepts the argument -W'); } elseif ($Host === false) { print 'Could not retrieve host.'; } else { print $Host; }