handle case if there is no hostname
This commit is contained in:
13
index.php
13
index.php
@@ -145,7 +145,7 @@ function show_dnsrecords($hostname) {
|
|||||||
echo "" . $value['rname'] . " (rname), ";
|
echo "" . $value['rname'] . " (rname), ";
|
||||||
echo "" . $value['serial'] . " (serial)<br />\n";
|
echo "" . $value['serial'] . " (serial)<br />\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// OTHER
|
// OTHER
|
||||||
$dnsrecords = dnsrecords($hostname, "OTHER");
|
$dnsrecords = dnsrecords($hostname, "OTHER");
|
||||||
if(!empty($dnsrecords)) {
|
if(!empty($dnsrecords)) {
|
||||||
@@ -178,8 +178,8 @@ function print_footer() {
|
|||||||
|
|
||||||
// HELPER FUNCTIONS
|
// HELPER FUNCTIONS
|
||||||
function readheader($value) {
|
function readheader($value) {
|
||||||
echo "<strong>" . $value . "</strong>: "; // show desired value
|
echo "<strong>" . $value . "</strong>: "; // show desired value
|
||||||
if(isset($_SERVER[$value])) { // only if desired header has been delivered
|
if(isset($_SERVER[$value])) { // only if desired header has been delivered
|
||||||
echo $_SERVER[$value];
|
echo $_SERVER[$value];
|
||||||
}
|
}
|
||||||
echo "<br />\n";
|
echo "<br />\n";
|
||||||
@@ -189,7 +189,12 @@ function ip2hostname($ip) {
|
|||||||
return $hostname;
|
return $hostname;
|
||||||
}
|
}
|
||||||
function hostname2ip($hostname) {
|
function hostname2ip($hostname) {
|
||||||
$ip = implode(', ', gethostbynamel($hostname));
|
$ipsbyhostname = gethostbynamel($hostname);
|
||||||
|
if($ipsbyhostname === false) {
|
||||||
|
$ip = $hostname;
|
||||||
|
} else {
|
||||||
|
$ip = implode(', ', gethostbynamel($hostname));
|
||||||
|
}
|
||||||
return $ip;
|
return $ip;
|
||||||
}
|
}
|
||||||
function dnsrecords($hostname, $record = "DNS_ALL") {
|
function dnsrecords($hostname, $record = "DNS_ALL") {
|
||||||
|
|||||||
Reference in New Issue
Block a user