fixed IP check
This commit is contained in:
parent
e7e4e13ac5
commit
af43a42224
|
@ -59,11 +59,16 @@ if (!function_exists('check_ip')) {
|
||||||
if (!is_numeric($part[$i])) {
|
if (!is_numeric($part[$i])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
elseif ($part[$i] > 255) {
|
||||||
// if not check Subnet, than segment must be smaller than 256, else smaller than 255
|
|
||||||
if($part[$i] > 255 || ($i==3 && (!$subnet && $part[$i]<1)) || ($i==3 && (!$subnet && $part[$i]<0))) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// non-subnet must be > 0 on last digit
|
||||||
|
elseif (!$subnet && ($i == 3) && ($part[$i] < 1)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// subnet must be >= 0 on last digit
|
||||||
|
elseif ($subnet && ($i == 3) && ($part[$i] < 0)) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -391,9 +396,6 @@ By default, the nodes are configured as H-Nodes which fits for small networks. I
|
||||||
elseif (!check_ip($_POST['cn'],true)) {
|
elseif (!check_ip($_POST['cn'],true)) {
|
||||||
$errors[] = $this->messages['cn'][2];
|
$errors[] = $this->messages['cn'][2];
|
||||||
}
|
}
|
||||||
elseif (strrpos($_POST['cn'], '.0') != (strlen($_POST['cn']) - 2)) {
|
|
||||||
$errors[] = $this->messages['cn'][2];
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
// if the cn was edit, reload the Ranges:
|
// if the cn was edit, reload the Ranges:
|
||||||
if ($this->getAccountContainer()->getAccountModule('range')->reload_ranges())
|
if ($this->getAccountContainer()->getAccountModule('range')->reload_ranges())
|
||||||
|
|
Loading…
Reference in New Issue