$slt = "";
for($i = 0; $i < $sns; $i++) {
+ if($i!=0) $slt .= ":";
if(strlen($pss[$i]) < 1) {
error_log("no 3");
return false;
}
+ $slt .= "".$pss[$i];
}
// we are still a valid ipv6 ip address/mask
}
}
- function addSupernet($supernet)
+ function addSupernet($name, $sn, $mask, $desc)
{
+ global $db;
+ if(ip::isValid($sn, $mask)) {
+ $sn = ip::truncateNetwork($sn, $mask);
+ $sql = "insert into supernet values (NULL, '$name', '$sn', '$mask', '$desc')";
+ $db->dbobject->query($sql);
+ return true;
+ }
+ return false;
}
function addSubnet($subnet)
$mask = $_REQUEST["mask"];
$desc = $_REQUEST["desc"];
- if(ip::isValid($sn, $mask)) {
- $sn = ip::truncateNetwork($sn, $mask);
- $sql = "insert into supernet values (NULL, '$name', '$sn', '$mask', '$desc')";
- $db->dbobject->query($sql);
+ $myip = new ip();
+
+ if($myip->addSupernet($name, $sn, $mask, $desc)) {
header("Location: index.php?notice=range added");
} else {
header("Location: index.php?error=invalid ipaddress");