diff options
-rw-r--r-- | ddns.php | 27 |
1 files changed, 15 insertions, 12 deletions
@@ -203,24 +203,27 @@ $zone_file .= fread($pin, 1024); $zone_file = explode("\n", trim($zone_file)); pclose($pin); + $updateCommand .= + "zone ddns.eckner.net.\n"; foreach($aliasess as $aliases) { $aliases = explode(' ', trim($aliases)); $alias = array_shift($aliases); - $updateCommand .= - "zone ddns.eckner.net.\n" . - "prereq yxrrset " . $alias . ".ddns.eckner.net.\n" . - "update delete " . $alias . ".ddns.eckner.net.\n" . - "send\n"; - foreach($aliases as $representative) { - foreach($zone_file as $zone_file_entry) { - if (preg_match('/^'.$representative.' ([0-9]+) (AAAA|A) (\S+)$/', $zone_file_entry, $match)) { - $updateCommand .= - "update add " . $alias . ".ddns.eckner.net. " . $match[1] . " IN " . $match[2] . " " . $match[3] . "\n"; + foreach ($hasRrType as $rrType => $dummy) { + $updateCommand .= + "prereq yxrrset " . $alias . ".ddns.eckner.net. IN " . $rrType . "\n" . + "update delete " . $alias . ".ddns.eckner.net. IN " . $rrType . "\n" . + "send\n"; + foreach($aliases as $representative) { + foreach($zone_file as $zone_file_entry) { + if (preg_match('/^'.$representative.' ([0-9]+) (' . $rrType . ') (\S+)$/', $zone_file_entry, $match)) { + $updateCommand .= + "update add " . $alias . ".ddns.eckner.net. " . $match[1] . " IN " . $match[2] . " " . $match[3] . "\n"; + } } } + $updateCommand .= + "send\n"; } - $updateCommand .= - "send\n"; } } |