Added “pattmods” function argument

This commit is contained in:
pezcurrel 2024-07-14 21:36:50 +02:00
parent c61e9ceecc
commit 768cbc0aec

View file

@ -1,5 +1,5 @@
<?php
function validhostname($inp) {
function validhostname($inp,$pattmods='') {
if (strlen($inp)>253)
return(false);
$inp=explode('.',$inp);
@ -7,7 +7,7 @@ function validhostname($inp) {
$len=strlen($lab);
if ($len==0 || $len>63)
return(false);
if (preg_match('#^[a-z0-9]([a-z0-9-]*[a-z0-9])?$#',$lab)!==1)
if (preg_match('#^[a-z0-9]([a-z0-9-]*[a-z0-9])?$#'.$pattmods,$lab)!==1)
return(false);
}
return(true);