HEX
Server: LiteSpeed
System: Linux houston.panomity.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: nudepix (1011)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/panomity.de/panomity.com/dyndns/update.php
<?php
/* DynDNS update handler for FRITZ!Box – dual‑stack safe
 * PowerDNS Authoritative 4.8.x, HTTP‑API enabled on 127.0.0.1:8081
 */

$apiKey  = 'ORhrlgi39d0zLtGV';
$zone    = 'muc.panomity.com.';   // trailing dot!
$ttl     = 60;

/*–----------------------------------------------------------------------*/
/* 1.  Basic‑Auth (overwrite user/pw to match your .htpasswd)            */

if (($_SERVER['PHP_AUTH_USER'] ?? '') !== 'panomity' ||
    ($_SERVER['PHP_AUTH_PW']   ?? '') !== 's3cret') {
    header('HTTP/1.1 401 Unauthorized');
    echo "badauth\n";
    exit;
}

/*–----------------------------------------------------------------------*/
/* 2.  Parse IPs                                                          */

$ip4 = $_GET['myip']   ?? null;        // supplied in Update‑URL, may be empty
$ip6 = $_GET['myipv6'] ?? null;        // fritzbox 7.5+ placeholder

/* allow the classic style where box omits placeholders */
if (!$ip4 && filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4))
    $ip4 = $_SERVER['REMOTE_ADDR'];
if (!$ip6 && filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
    $ip6 = $_SERVER['REMOTE_ADDR'];

if (!$ip4 && !$ip6) {
    echo "911 bad ip\n";
    exit;
}

/*–----------------------------------------------------------------------*/
/* 3.  Build PowerDNS PATCH payload                                       */

$rrsets = [];
if ($ip4) $rrsets[] = [
        'name'       => $zone,
        'type'       => 'A',
        'ttl'        => $ttl,
        'changetype' => 'REPLACE',
        'records'    => [[ 'content' => $ip4, 'disabled' => false ]]
];
if ($ip6) $rrsets[] = [
        'name'       => $zone,
        'type'       => 'AAAA',
        'ttl'        => $ttl,
        'changetype' => 'REPLACE',
        'records'    => [[ 'content' => $ip6, 'disabled' => false ]]
];

$json = json_encode(['rrsets' => $rrsets]);

/*–----------------------------------------------------------------------*/
/* 4.  Send to PDNS API                                                   */

$ch = curl_init("http://127.0.0.1:8081/api/v1/servers/localhost/zones/$zone");
curl_setopt_array($ch, [
  CURLOPT_CUSTOMREQUEST => 'PATCH',
  CURLOPT_HTTPHEADER    => [ "X-API-Key: $apiKey", "Content-Type: application/json" ],
  CURLOPT_POSTFIELDS    => $json,
  CURLOPT_RETURNTRANSFER=> true
]);
curl_exec($ch);
$http = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($http === 204) {
    echo "good ".($ip4 ?: $ip6)."\n";
    /* kick immediate NOTIFY */
    exec("pdns_control notify muc.panomity.com");
} elseif ($http === 422) {
    echo "nochg ".($ip4 ?: $ip6)."\n";
} else {
    echo "911 pdns error\n";
}