diff --git a/web/lib/validhostname.php b/web/lib/validhostname.php new file mode 100644 index 0000000..3d215d8 --- /dev/null +++ b/web/lib/validhostname.php @@ -0,0 +1,18 @@ +$c) ? $multibyte=true : $multibyte=false; + if ($multibyte) $hostname=idn_to_ascii($hostname,IDNA_DEFAULT,INTL_IDNA_VARIANT_UTS46); + if (strlen($hostname)>253) + return false; + $labs=explode('.',$hostname); + foreach ($labs as $lab) { + $len=strlen($lab); + if ($len==0 || $len>63) + return false; + if (preg_match('#^[a-z0-9]([a-z0-9-]*[a-z0-9])?$#i'.$pattmods,$lab)!==1) + return false; + } + return true; +} +?>