summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2017-04-13 15:22:04 +0100
committerLuke Bratch <luke@bratch.co.uk>2017-04-13 15:22:04 +0100
commit6d2eb372a4c5493029b8443c06a2b59b24893232 (patch)
tree3c8b1532936fca46b828df3124b59181ce45b17b
parent6dcefcf6cca0f44bb8c06f7cc24d60402c3a4fdd (diff)
Fix some places where functions were using global POST variables instead of what was passed to them
-rw-r--r--dns.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/dns.php b/dns.php
index 0f7c683..cbef901 100644
--- a/dns.php
+++ b/dns.php
@@ -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 {