prepare("INSERT INTO zones(zone, username) VALUES(:zone, :username)"); $stmt->bindValue(':zone', $_POST['domain']); $stmt->bindValue(':username', $_SESSION['username']); $stmt->execute(); $knotZonePath = CONF['ns']['knot_zones_path'] . "/" . $_POST['domain'] . "zone"; $knotZone = $_POST['domain'] . ' 3600 SOA ns1.niver.test. admin.niver.test. 1 21600 7200 3628800 3600 ' . $_POST['domain'] . ' 86400 NS ns1.niver.test. '; if (is_int(file_put_contents($knotZonePath, $knotZone)) !== true) serverError("Failed to write new zone file."); if (chmod($knotZonePath, 0660) !== true) serverError("Failed to chmod new zone file."); exec(CONF['dns']['knotc_path'] . " conf-begin"); exec(CONF['dns']['knotc_path'] . " conf-set 'zone[" . $_POST['domain'] . "]'"); exec(CONF['dns']['knotc_path'] . " conf-set 'zone[" . $_POST['domain'] . "].template' 'niver'"); exec(CONF['dns']['knotc_path'] . " conf-commit"); success("La requête a été traitée.");