Allow "-" and "_" in domain names

This commit is contained in:
Miraty 2021-10-03 18:05:59 +02:00
parent fdfec134b9
commit 072978628b
2 changed files with 3 additions and 3 deletions

View file

@ -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>

View file

@ -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");
}