diff --git a/api_db.php b/api_db.php index 019fb7ac..51d59ba4 100644 --- a/api_db.php +++ b/api_db.php @@ -87,7 +87,6 @@ if(isset($_GET["network"]) && $auth) $data = array_merge($data, array('network' => $network)); } -$qtypes = ["A", "AAAA", "ANY", "SRV", "SOA", "PTR", "TXT", "NAPTR", "MX", "DS", "RRSIG", "DNSKEY", "NS", "OTHER", "SVCB", "HTTPS"]; if (isset($_GET['getAllQueries']) && $auth) { $allQueries = array(); @@ -121,17 +120,14 @@ if (isset($_GET['getAllQueries']) && $auth) if(!is_bool($results)) while ($row = $results->fetchArray()) { + // Try to resolve host name of this client $c = resolveHostname($row[3],false); // Convert query type ID to name - // Names taken from FTL's query type names - $qtype = intval($row[1]); - if($qtype > 0 && $qtype <= count($qtypes)) - $query_type = $qtypes[$qtype-1]; - else - $query_type = "TYPE".(intval($row[1]) - 100); + $query_type = getQueryTypeStr($row[1]); - // array: time type domain client status upstream destination + // Insert into array + // array: time type domain client status upstream destination $allQueries[] = [$row[0], $query_type, utf8_encode(str_replace("~"," ",$row[2])), utf8_encode($c), $row[4], utf8_encode($row[5])]; } } diff --git a/cname_records.php b/cname_records.php index 0e4e7e16..53dcdab5 100644 --- a/cname_records.php +++ b/cname_records.php @@ -40,7 +40,7 @@