$keyfile, 'plgversion' => $plgversion ]; if ($isCertUnraidNet) { // if there is an unraid.net cert, enable local ddns regardless of use_ssl value $post['internalip'] = is_array($internalip) ? $internalip[0] : $internalip; // if DNS Rebind Protection is disabled and host.unraid.net does not resolve to the internalip, disable caching if ($rebindDisabled && (host_lookup_ip($certhostname) != $post['internalip'])) $dnserr = true; } if ($isRegistered) { $post['internalhostname'] = $internalhostname; $post['internalport'] = $internalport; $post['internalprotocol'] = $internalprotocol; $post['servercomment'] = $var['COMMENT']; $post['servername'] = $var['NAME']; } // maxage is 36 hours $maxage = 36*60*60; if ($dnserr || $verbose) $maxage = 0; $datafile = "/tmp/UpdateDNS.txt"; $dataprev = @file_get_contents($datafile) ?: ''; $datanew = implode("\n",$post)."\n"; if ($datanew == $dataprev && (time()-filemtime($datafile) < $maxage)) { response_complete(204, null, _('No change to report')); } file_put_contents($datafile,$datanew); // report necessary server details to limetech for DNS updates $ch = curl_init('https://keys.lime-technology.com/account/server/register'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); $error = curl_error($ch); curl_close($ch); if ($result === false) { // delete cache file to retry submission on next run @unlink($datafile); response_complete(500, '{"error":"'.$error.'"}'); } response_complete($httpcode, $result, _('success')); ?>