if ($host != $resolvedptr) { $tmpresolved = array(); $tmpresolved['type'] = "PTR"; $tmpresolved['data'] = $resolvedptr; $resolved[] = $tmpresolved; } } elseif (is_hostname($host)) { $type = "hostname"; $ipaddr = gethostbyname($host); $resolved = resolve_host_addresses($host); } } } if ($_POST['host'] && $_POST['dialog_output']) { $host = isset($resolvedptr) ? $resolvedptr : $host; display_host_results($ipaddr, $host, $dns_speeds); exit; } function display_host_results($address, $hostname, $dns_speeds) { $map_lengths = function ($element) { return strlen($element[0]); }; echo gettext("IP Address") . ": " . htmlspecialchars($address) . " \n"; echo gettext("Host Name") . ": " . htmlspecialchars($hostname) . " \n"; echo "\n"; $text_table = array(); $text_table[] = array(gettext("Server"), gettext("Query Time")); if (is_array($dns_speeds)) { foreach ($dns_speeds as $qt) { $text_table[] = array(trim($qt['dns_server']), trim($qt['query_time']));
if ($resolved) { $resolved = array(); exec("/usr/bin/drill {$host_esc} A | /usr/bin/grep {$host_esc} | /usr/bin/grep -v ';' | /usr/bin/awk '{ print \$5 }'", $resolved); } $hostname = $host; if ($host != $resolved) { $ipaddr = $resolved[0]; } } if ($host == $resolved) { $resolved = gettext("No record found"); } } } if ($_POST['host'] && $_POST['dialog_output']) { display_host_results($host, $resolved, $dns_speeds); exit; } function display_host_results($address, $hostname, $dns_speeds) { $map_lengths = function ($element) { return strlen($element[0]); }; echo gettext("IP Address") . ": {$address} \n"; echo gettext("Host Name") . ": {$hostname} \n"; echo "\n"; $text_table = array(); $text_table[] = array(gettext("Server"), gettext("Query Time")); if (is_array($dns_speeds)) { foreach ($dns_speeds as $qt) { $text_table[] = array(trim($qt['dns_server']), trim($qt['query_time']));