Commit 340d4cff authored by anarcat's avatar anarcat

1334210 by bart.hanssens: IPv6 support in IP checks

parent 274afb22
......@@ -17,17 +17,7 @@
* TRUE is the $hostname is a valid IP address, FALSE otherwise.
*/
function _hosting_valid_ip($hostname) {
//TODO : provide IPv6 support
$parts = explode('.', $hostname);
if (sizeof($parts) != 4) {
return FALSE;
}
foreach ($parts as $part) {
if (((int) $part < 0) || ((int) $part > 255)) {
return FALSE;
}
}
return TRUE;
return is_string(inet_pton($hostname));
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment