diff options
author | Guillaume Mazoyer <gmazoyer@gravitons.in> | 2015-11-08 13:12:54 +0100 |
---|---|---|
committer | Guillaume Mazoyer <gmazoyer@gravitons.in> | 2015-11-08 13:12:54 +0100 |
commit | a1adf5af8394960a1bc2813364b800180df27f84 (patch) | |
tree | dd55053ac50b289a41a657d9cb6e2a80f0a1476b /includes/utils.php | |
parent | 3fd52dbda02bd2a54ee36c7c6c791c8e06653b6f (diff) |
Ensure hostname is not an IP address.
Diffstat (limited to 'includes/utils.php')
-rw-r--r-- | includes/utils.php | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/includes/utils.php b/includes/utils.php index 79888dd..993300b 100644 --- a/includes/utils.php +++ b/includes/utils.php @@ -153,6 +153,11 @@ function match_ipv6($ip, $ip_only = true) { * otherwise. */ function match_hostname($hostname) { + // That's an IP address so it is not a valid hostname. + if (match_ipv4($hostame) || match_ipv6($hostname)) { + return false; + } + return ( // Valid characters check preg_match('/^(_?[a-z\d](-*[_a-z\d])*)(\.(_?[a-z\d](-*[_a-z\d])*))*$/i', $hostname) |