Code optimisations for localhost:IPv6 #17

This commit is contained in:
Stefan Brannfjell 2014-02-08 20:34:00 +01:00
parent 8ebbd9c81f
commit 1946d87911
2 changed files with 4 additions and 2 deletions

View File

@ -236,13 +236,15 @@ function validate_name($string) {
}
}
// Checks if an IPv4 address is valid
// Checks if an IPv4(or localhost IPv6) address is valid
function validate_ip($ip) {
$ipL = ip2long($ip);
$ipR = long2ip($ipL);
if ($ip === $ipR) {
return true;
} elseif ($ip=='::1') {
return true;
} else {
return false;
}

View File

@ -1,3 +1,3 @@
order deny,allow
deny from all
allow from 127.0.0.1
allow from 127.0.0.1 localhost ::1