diff --git a/utils.inc.php b/utils.inc.php index ce17408..28ea934 100644 --- a/utils.inc.php +++ b/utils.inc.php @@ -11,9 +11,15 @@ function checkDNS($domain, $withWww = false) if (empty($currentip)) { throw new Exception('the domain '.$domain.' was not found in DNS record.'); } + if (empty($currentip[0]['ip'])) { + throw new Exception('the domain '.$domain.' has no ip v4 in DNS record.'); + } if ($currentip[0]['ip'] !== $_SERVER['ip4']) { throw new Exception('the current ip v4 address of '.$domain.' is '.$currentip[0]['ip'].'. it should be '.$_SERVER['ip4']); } + if (empty($currentip[0]['ipv6'])) { + throw new Exception('the domain '.$domain.' has no ip v6 in DNS record.'); + } if ($currentip[1]['ipv6'] !== $_SERVER['ip6']) { throw new Exception('the current ip v6 address of '.$domain.' is '.$currentip[1]['ipv6'].'. it should be '.$_SERVER['ip6']); }