Commit 81f96da8 authored by haemmer's avatar haemmer
Browse files

Did some refactoring

parent 06b1e01e
...@@ -394,8 +394,8 @@ function isIPinCIDRBlock($cidr, $ip) { ...@@ -394,8 +394,8 @@ function isIPinCIDRBlock($cidr, $ip) {
list ($net, $mask) = split ("/", $cidr); list ($net, $mask) = split ("/", $cidr);
// Convert to binary string value of 1s and 0s // Convert to binary string value of 1s and 0s
$netAsBinary = ip2bin($net); $netAsBinary = convertIPtoBinaryForm($net);
$ipAsBinary = ip2bin($ip); $ipAsBinary = convertIPtoBinaryForm($ip);
// Return false if netmask and ip are using different protocols // Return false if netmask and ip are using different protocols
if (strlen($netAsBinary) != strlen($ipAsBinary)){ if (strlen($netAsBinary) != strlen($ipAsBinary)){
...@@ -418,7 +418,7 @@ function isIPinCIDRBlock($cidr, $ip) { ...@@ -418,7 +418,7 @@ function isIPinCIDRBlock($cidr, $ip) {
/******************************************************************************/ /******************************************************************************/
// Converts IP in human readable format to binary string // Converts IP in human readable format to binary string
function ip2bin($ip){ function convertIPtoBinaryForm($ip){
// Handle IPv4 IP // Handle IPv4 IP
if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false){ if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false){
......
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