Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
GIP RENATER
switch-wayf
Commits
81f96da8
Commit
81f96da8
authored
Jun 03, 2011
by
haemmer
Browse files
Did some refactoring
parent
06b1e01e
Changes
1
Hide whitespace changes
Inline
Side-by-side
functions.php
View file @
81f96da8
...
...
@@ -394,8 +394,8 @@ function isIPinCIDRBlock($cidr, $ip) {
list
(
$net
,
$mask
)
=
split
(
"/"
,
$cidr
);
// Convert to binary string value of 1s and 0s
$netAsBinary
=
ip2bin
(
$net
);
$ipAsBinary
=
ip2bin
(
$ip
);
$netAsBinary
=
convertIPtoBinaryForm
(
$net
);
$ipAsBinary
=
convertIPtoBinaryForm
(
$ip
);
// Return false if netmask and ip are using different protocols
if
(
strlen
(
$netAsBinary
)
!=
strlen
(
$ipAsBinary
)){
...
...
@@ -418,7 +418,7 @@ function isIPinCIDRBlock($cidr, $ip) {
/******************************************************************************/
// Converts IP in human readable format to binary string
function
ip2bin
(
$ip
){
function
convertIPtoBinaryForm
(
$ip
){
// Handle IPv4 IP
if
(
filter_var
(
$ip
,
FILTER_VALIDATE_IP
,
FILTER_FLAG_IPV4
)
!==
false
){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment