diff options
-rw-r--r-- | dns.php | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -60,7 +60,7 @@ function sshrun($command) { } function getzone($domain, $password) { - if (!preg_match('/^[0-9A-Za-z\.\-]*$/', $_POST['domain'])) { + if (!preg_match('/^[0-9A-Za-z\.\-]*$/', $domain)) { die("invalid domain"); } @@ -77,7 +77,7 @@ function getzone($domain, $password) { } function writezone($domain, $password, $zonetext) { - if (!preg_match('/^[0-9A-Za-z\.\-]*$/', $_POST['domain'])) { + if (!preg_match('/^[0-9A-Za-z\.\-]*$/', $domain)) { die("invalid domain"); } @@ -85,10 +85,6 @@ function writezone($domain, $password, $zonetext) { die("somehow the password went bad"); } - if (isset($_POST['increment'])) { - $zonetext = incrementserial($zonetext)[0]; - } - $zonetext = str_replace('$', '\$', $zonetext); sshrun("echo -en \"$zonetext\" > " . ZONEROOT . "$domain" . ZONESUFFIX); @@ -127,6 +123,10 @@ if (isset($_POST['domain']) && isset($_POST['password']) && !isset($_POST['zonet } } else if (isset($_POST['domain']) && isset($_POST['password']) && isset($_POST['zonetext'])) { $zonetext = str_replace("\r", '', $_POST['zonetext']); + // Increment the serial number if the box was checked + if (isset($_POST['increment'])) { + $zonetext = incrementserial($zonetext)[0]; + } writezone($_POST['domain'], $_POST['password'], $zonetext); echo "<p>all done :)</p>"; } else { |