From 6b2f5a30d254a378e62c455e9b6389ead076e599 Mon Sep 17 00:00:00 2001 From: Patrik Kernstock Date: Sun, 15 Sep 2019 20:40:07 +0100 Subject: [PATCH] Slightly modified is_valid_domain_name for #1118 --- data/web/inc/functions.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data/web/inc/functions.inc.php b/data/web/inc/functions.inc.php index 90a5b638..9012e8a6 100644 --- a/data/web/inc/functions.inc.php +++ b/data/web/inc/functions.inc.php @@ -709,14 +709,14 @@ function user_get_alias_details($username) { } return $data; } -function is_valid_domain_name($domain_name) { +function is_valid_domain_name($domain_name) { if (empty($domain_name)) { return false; } $domain_name = idn_to_ascii($domain_name, 0, INTL_IDNA_VARIANT_UTS46); - return (preg_match("/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $domain_name) + return (preg_match("/^([a-z\d](-*[a-z\d])*)\.(([a-z\d](-*[a-z\d])*))*$/i", $domain_name) && preg_match("/^.{1,253}$/", $domain_name) - && preg_match("/^[^\.]{1,63}(\.[^\.]{1,63})*$/", $domain_name)); + && preg_match("/^[^\.]{1,63}\.([^\.]{1,63})*$/", $domain_name)); } function set_tfa($_data) { global $lang;