Browse Source

ns/ & ht/: check that domain isn't already used

Miraty 2 năm trước cách đây
mục cha
commit
247c814d5d
2 tập tin đã thay đổi với 6 bổ sung0 xóa
  1. 3 0
      public/ht/add-http-dns.php
  2. 3 0
      public/ns/zone-add.php

+ 3 - 0
public/ht/add-http-dns.php

@@ -41,6 +41,9 @@ checkDomainFormat($_POST['domain']);
 if ($dirsStatuses[$_POST['dir']] !== false)
 	userError("Wrong value for <code>dir</code>.");
 
+if (query('select', 'sites', ['domain' => $_POST['domain']], 'domain') !== [])
+	userError("Ce domaine existe déjà sur ce service.");
+
 addSite($_SESSION['username'], $_POST['dir'], $_POST['domain'], "dns", "http");
 
 $nginxConf = 'server {

+ 3 - 0
public/ns/zone-add.php

@@ -12,6 +12,9 @@ switchToFormProcess();
 
 $_POST['domain'] = formatAbsoluteDomain($_POST['domain']);
 
+if (query('select', 'zones', ['zone' => $_POST['domain']], 'zone') !== [])
+	userError("Cette zone existe déjà sur ce service.");
+
 $db = new PDO('sqlite:' . DB_PATH);
 $stmt = $db->prepare("INSERT INTO zones(zone, username) VALUES(:zone, :username)");