summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dns.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/dns.php b/dns.php
index d2dcc19..a21b00f 100644
--- a/dns.php
+++ b/dns.php
@@ -122,8 +122,13 @@ function writezone($domain, $zonetext, $password = null) {
// Reload the zone if we got this far
$zonewrite = sshrun("echo -en \"$zonetext\" > " . ZONEROOT . "$domain" . ZONESUFFIX . " && echo $? || echo $?");
+ // Remove any trailing newlines from the returned string
+ while ($zonewrite[strlen($zonewrite) - 1] == "\n") {
+ $zonewrite = $zonewrite[strlen($zonewrite) - 2];
+ }
+
// If the return code was non-zero then fail
- if ($zonewrite[sizeof($zonewrite) - 1] != "0") {
+ if ($zonewrite[strlen($zonewrite) - 1] != "0") {
echo "<p>error: something went wrong when writing the zone file, please ask someone for help</p>";
die();
}