$_SESSION['id'], 'domain' => $domain], ['domain']) !== []) output(403, _('The current account already owns this domain.')); $ns_records = array_column(kdig(name: $domain, type: 'NS', server: CONF['reg']['address'])['authorityRRs'], 'rdataNS'); if (preg_match('/^(?[0-9a-f]{8})-(?[0-9a-f]{32})\._transfer-verification\.' . preg_quote(SERVER_NAME, '/') . '\.$/Dm', implode(LF, $ns_records), $matches) !== 1) output(403, _('NS authentication record not found.')); checkAuthToken($matches['salt'], $matches['hash']); rateLimit(); DB->prepare('UPDATE registry SET username = :username WHERE domain = :domain') ->execute([':username' => $_SESSION['id'], ':domain' => $domain]); knotcZoneExec($_POST['suffix'], [ $domain, 'NS', $matches['salt'] . '-' . $matches['hash'] . '._transfer-verification.' . SERVER_NAME . '.' ], 'delete'); output(200, _('The domain has been transferred to the current account ; the NS authentication record has been automatically deleted.'));