= 16 && $OctOrHextets[1] <= 32)) ) { error('Invalid IPv4 address.'); } foreach ($OctOrHextets as $Octet) { if ($Octet > 255 || $Octet < 0) { error('Invalid IPv4 address.'); } } } elseif (sizeof($OctOrHextets) <= 8) { // IPv6 foreach ($OctOrHextets as $Hextet) { if (strlen($Hextet) > 4) { error('Invalid IPv6 address.'); } } } else { error('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) { echo 'Could not retrieve host.'; } else { echo $Host; }