|
@@ -14,13 +14,17 @@ if (processForm()) {
|
|
|
if (query('select', 'sites', ['domain' => $_POST['domain']], 'domain') !== [])
|
|
|
userError("Ce domaine existe déjà sur ce service.");
|
|
|
|
|
|
- $remoteAaaaRecords = array_column(dns_get_record($_POST['domain'], DNS_AAAA), 'ipv6');
|
|
|
- if (array_merge(array_diff($remoteAaaaRecords, [CONF['ht']['ipv6_address']]), array_diff([CONF['ht']['ipv6_address']], $remoteAaaaRecords)) !== [])
|
|
|
- userError("Ce domaine doit avoir pour enregistrement AAAA <code>" . CONF['ht']['ipv6_address'] . "</code>.");
|
|
|
-
|
|
|
- $remoteARecords = array_column(dns_get_record($_POST['domain'], DNS_A), 'ip');
|
|
|
- if (array_merge(array_diff($remoteARecords, [CONF['ht']['ipv4_address']]), array_diff([CONF['ht']['ipv4_address']], $remoteARecords)) !== [])
|
|
|
- userError("Ce domaine doit avoir pour enregistrement A <code>" . CONF['ht']['ipv4_address'] . "</code>.");
|
|
|
+ $remoteAaaaRecords = dns_get_record($_POST['domain'], DNS_AAAA);
|
|
|
+ if (is_array($remoteAaaaRecords) !== true)
|
|
|
+ userError("Ce domaine n'existe pas.");
|
|
|
+ if (equalArrays([CONF['ht']['ipv6_address']], array_column($remoteAaaaRecords, 'ipv6')) !== true)
|
|
|
+ userError("Ce domaine doit avoir pour unique enregistrement AAAA <code>" . CONF['ht']['ipv6_address'] . "</code>.");
|
|
|
+
|
|
|
+ $remoteARecords = dns_get_record($_POST['domain'], DNS_A);
|
|
|
+ if (is_array($remoteARecords) !== true)
|
|
|
+ userError("Ce domaine n'existe pas.");
|
|
|
+ if (equalArrays([CONF['ht']['ipv4_address']], array_column($remoteARecords, 'ip')) !== true)
|
|
|
+ userError("Ce domaine doit avoir pour unique enregistrement A <code>" . CONF['ht']['ipv4_address'] . "</code>.");
|
|
|
|
|
|
addSite($_SESSION['username'], $_POST['dir'], $_POST['domain'], "dns", "http");
|
|
|
|