IP Sorting is not correct
Brought to you by:
trilexcom
Trying to make some different subnets showed, that the IP sorting is not 100% correct.
Creating an array with the values first and doing a natsort on it, solves the problem in box_CidrMenu.php
e.g.
// After the SQL Queries
$values = array();
# Create array of all IPs.
# This means there mustn't be duplicate IPs!
while($row = mysql_fetch_array($sql)){
$values[$row[NetMenuCidr]]=$row;
}
# Sort the values by Key
$values = natksort($values);
# uncommented:
# while($row = mysql_fetch_array($sql)){
foreach ($values as $key=>$row){
function natksort($array) {
// Like ksort but uses natural sort instead
$keys = array_keys($array);
natsort($keys);
foreach ($keys as $k)
$new_array[$k] = $array[$k];
return $new_array;
}