|
@@ -0,0 +1,46 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+if (processForm()) {
|
|
|
+ if (preg_match('/' . SUBDOMAIN_REGEX . '/D', $_POST['domain']) !== 1)
|
|
|
+ output(403, 'Le nom de domaine semble incorrect');
|
|
|
+
|
|
|
+ $domain = $_POST['domain'] . '.' . CONF['reg']['registry'];
|
|
|
+
|
|
|
+ if (query('select', 'registry', ['username' => $_SESSION['id'], 'domain' => $domain], 'domain') !== [])
|
|
|
+ output(403, 'Le compte présent possède déjà ce domaine.');
|
|
|
+
|
|
|
+ exec(CONF['dns']['kdig_path'] . ' ' . $domain . ' NS @' . CONF['reg']['address'] . ' +noidn', $results);
|
|
|
+ if (preg_match('/^' . preg_quote($domain, '/') . '[\t ]+[0-9]{1,8}[\t ]+IN[\t ]+NS[\t ]+(?<salt>[0-9a-f]{8})-(?<hash>[0-9a-f]{32})\._transfer-verification\.' . preg_quote(SERVER_NAME, '/') . '\.$/Dm', implode(LF, $results), $matches) !== 1)
|
|
|
+ output(403, 'Enregistrement d\'authentification introuvable');
|
|
|
+
|
|
|
+ checkAuthToken($matches['salt'], $matches['hash']);
|
|
|
+
|
|
|
+ $stmt = DB->prepare('UPDATE registry SET username = :username WHERE domain = :domain');
|
|
|
+ $stmt->bindValue(':username', $_SESSION['id']);
|
|
|
+ $stmt->bindValue(':domain', $domain);
|
|
|
+ $stmt->execute();
|
|
|
+
|
|
|
+ knotcZoneExec(CONF['reg']['registry'], [
|
|
|
+ $domain,
|
|
|
+ 'NS',
|
|
|
+ $matches['salt'] . '-' . $matches['hash'] . '._transfer-verification.' . SERVER_NAME . '.'
|
|
|
+ ], 'delete');
|
|
|
+
|
|
|
+ output(200, 'Le domaine a été transféré vers le compte présent, l\'enregistrement d\'authentification a été automatiquement retiré.');
|
|
|
+}
|
|
|
+
|
|
|
+$proof = getAuthToken();
|
|
|
+
|
|
|
+?>
|
|
|
+
|
|
|
+<p>
|
|
|
+ Pour prouver que vous êtes autorisé à recevoir le domaine par san possessaire actuele, ledit domaine doit posséder un <?= linkToDocs('ns-record', 'enregistrement NS') ?> égal à <code><?= $proof ?>._transfer-verification.<?= SERVER_NAME ?>.</code> lors du traitement de ce formulaire. Cet enregistrement sera automatiquement retiré une fois validé.
|
|
|
+</p>
|
|
|
+
|
|
|
+<form method="post">
|
|
|
+ <label for="subdomain">Sous-domaine à recevoir</label>
|
|
|
+ <br>
|
|
|
+ <code><input required="" placeholder="subdomain" id="subdomain" name="subdomain" type="text">.<?= CONF['reg']['registry'] ?></code>
|
|
|
+ <br>
|
|
|
+ <input value="Recevoir ce domaine" type="submit">
|
|
|
+</form>
|