diff options
-rw-r--r-- | ddns-status.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ddns-status.php b/ddns-status.php index 5c42ca7..2e7c38a 100644 --- a/ddns-status.php +++ b/ddns-status.php @@ -1,9 +1,17 @@ <?php +function die_http($error, $message, $extra_message) { + header('Status: ' . $error . ' ' . $message); + print 'Error ' . $error . ': ' . $message . "\n"; + if ($extra_message != '') + print "<br>\n" . $extra_message . "\n"; + die(); +} + $pin = popen('dig @127.0.0.1 ddns.eckner.net AXFR', 'r'); if (!$pin) - die(); + die_http(500, 'Internal Server Error', 'Failed to get Zone.'); $found = false; $axfr = array(); @@ -30,7 +38,7 @@ while (($line = fgets($pin)) !== false) { pclose($pin); if (! $found) - die(); + die_http(403, 'Forbidden', 'You are not known to ddns.'); $hosts = explode( "\n", |