summaryrefslogtreecommitdiff
path: root/includes/utils.php
diff options
context:
space:
mode:
authorGuillaume Mazoyer <gmazoyer@gravitons.in>2015-11-08 13:12:54 +0100
committerGuillaume Mazoyer <gmazoyer@gravitons.in>2015-11-08 13:12:54 +0100
commita1adf5af8394960a1bc2813364b800180df27f84 (patch)
treedd55053ac50b289a41a657d9cb6e2a80f0a1476b /includes/utils.php
parent3fd52dbda02bd2a54ee36c7c6c791c8e06653b6f (diff)
Ensure hostname is not an IP address.
Diffstat (limited to 'includes/utils.php')
-rw-r--r--includes/utils.php5
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)