Jelajahi Sumber

Allow "-" and "_" in domain names

Miraty 3 tahun lalu
induk
melakukan
072978628b
2 mengubah file dengan 3 tambahan dan 3 penghapusan
  1. 1 1
      inc/form/form.ns.inc.php
  2. 2 2
      inc/format.inc.php

+ 1 - 1
inc/form/form.ns.inc.php

@@ -10,7 +10,7 @@
   <div class="elForm">
     <label for="subdomain">Sous-domaine</label>
     <br>
-    <input id="subdomain" size="16" placeholder="www" pattern="^(([a-z0-9]{1,63}\.?){1,127})|(@){1}$" name="subdomain" type="text">
+    <input id="subdomain" size="16" placeholder="www" pattern="^(([a-z0-9_-]{1,63}\.?){1,127})|(@){1}$" name="subdomain" type="text">
   </div>
   <div class="elForm">
     <label for="zone">Zone</label>

+ 2 - 2
inc/format.inc.php

@@ -13,13 +13,13 @@ function checkIpFormat($ip) {
 
 function checkAbsoluteDomainFormat($domain) {
   // If the domain must end with a dot
-  if (!filter_var($domain, FILTER_VALIDATE_DOMAIN) OR !preg_match("/^([a-z0-9]{1,63}\.){2,127}$/", $domain))
+  if (!filter_var($domain, FILTER_VALIDATE_DOMAIN) OR !preg_match("/^([a-z0-9_-]{1,63}\.){2,127}$/", $domain))
     exit("ERROR: wrong domain");
 }
 
 function checkDomainFormat($domain) {
   // If the domain must end without a dot
-  if (!filter_var($domain, FILTER_VALIDATE_DOMAIN) OR !preg_match("/^([a-z0-9]{1,63}\.){1,126}[a-z0-9]{1,63}$/", $domain))
+  if (!filter_var($domain, FILTER_VALIDATE_DOMAIN) OR !preg_match("/^([a-z0-9_-]{1,63}\.){1,126}[a-z0-9]{1,63}$/", $domain))
     exit("ERROR: wrong domain");
 }