source: trunk/temp/test.php@ 738

Last change on this file since 738 was 738, checked in by chronos, 10 years ago
  • Removed: Spaces on end of line.
  • Modified: Tabs converted to spaces.
File size: 923 bytes
Line 
1<?php
2
3include_once(dirname(__FILE__).'/../Application/System.php');
4$System = new System();
5$System->ShowPage = false;
6$System->Run();
7
8$Addr = new NetworkAddressIPv6();
9
10$DbResult = $System->Database->select('NetworkInterface', 'Id, LocalIP, MAC', 'LocalIP != ""');
11while($DbRow = $DbResult->fetch_assoc())
12{
13 $DbResult2 = $System->Database->select('NetworkSubnet', 'AddressRangeIPv6',
14 'CompareNetworkPrefix(INET_ATON(AddressRange), INET_ATON("'.$DbRow['LocalIP'].'"), Mask) AND
15 (AddressRangeIPv6 != "")');
16 if($DbResult2->num_rows > 0)
17 {
18 $Subnet = $DbResult2->fetch_assoc();
19 $SubnetParts = explode('/', $Subnet['AddressRangeIPv6']);
20
21 $Addr->AddressFromString($SubnetParts[0]);
22 $Addr->EncodeMAC($DbRow['MAC']);
23 echo($Addr->AddressToString().' '.$DbRow['MAC']."\n");
24
25 $System->Database->update('NetworkInterface', 'Id='.$DbRow['Id'], array('IPv6' => $Addr->AddressToString()));
26 }
27}
Note: See TracBrowser for help on using the repository browser.