- Timestamp:
- Oct 4, 2009, 7:56:50 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/temp/renumbering.php
r251 r255 34 34 $Output = ''; 35 35 36 $DbResult = $this->Database->query('SELECT * FROM NetworkSubnet'); 36 $DbResult = $this->Database->query('SELECT * FROM NetworkSubnet WHERE CompareNetworkPrefix(INET_ATON("192.168.0.0"), INET_ATON(AddressRange), 16)'); 37 $Output .= 'UPDATE NetworkInterface SET CZFreeIP = LocalIP<br>'; 37 38 while($Subnet = $DbResult->fetch_assoc()) 38 39 { 39 $Output .= ' Podsíť '.$Subnet['Name'].': '.$Subnet['AddressRange'].'/'.$Subnet['Mask'].' => '.$this->SubnetTable[$Subnet['Id']]['AddressRange'].'/'.$this->SubnetTable[$Subnet['Id']]['Mask'].'<br>';40 $DbResult2 = $this->Database->query('SELECT NetworkInterface. LocalIP, NetworkDevice.Name FROM NetworkInterface JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device WHERE CompareNetworkPrefix(INET_ATON(NetworkInterface.LocalIP), INET_ATON("'.$Subnet['AddressRange'].'"), '.$Subnet['Mask'].') ORDER BY NetworkInterface.LocalIP');40 $Output .= '-- Podsíť '.$Subnet['Name'].': '.$Subnet['AddressRange'].'/'.$Subnet['Mask'].' => '.$this->SubnetTable[$Subnet['Id']]['AddressRange'].'/'.$this->SubnetTable[$Subnet['Id']]['Mask'].'<br>'; 41 $DbResult2 = $this->Database->query('SELECT NetworkInterface.Id, NetworkInterface.LocalIP, NetworkDevice.Name FROM NetworkInterface JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device WHERE CompareNetworkPrefix(INET_ATON(NetworkInterface.LocalIP), INET_ATON("'.$Subnet['AddressRange'].'"), '.$Subnet['Mask'].') ORDER BY NetworkInterface.LocalIP'); 41 42 $NextIP = IPv4ToInt32($this->SubnetTable[$Subnet['Id']]['AddressRange']) + 1; 42 43 while($Interface = $DbResult2->fetch_assoc()) 43 44 { 44 $Output .= ' '.$Interface['Name'].': '.$Interface['LocalIP'].' => '.Int32ToIPv4($NextIP).'<br>'; 45 $Output .= '-- '.$Interface['Name'].': '.$Interface['LocalIP'].' => '.Int32ToIPv4($NextIP).'<br>'; 46 $Output .= 'UPDATE NetworkInterface SET LocalIP = "'.Int32ToIPv4($NextIP).'" WHERE Id='.$Interface['Id'].';<br>'; 45 47 $NextIP++; 46 48 }
Note:
See TracChangeset
for help on using the changeset viewer.