UserName = $this->System->Config['MainRouter']['UserName']; $Routerboard->Timeout = $this->System->Config['MainRouter']['ConnectTimeout']; $Routerboard->Debug = true; $DbResult = $this->Database->query('SELECT * FROM `NetworkSubnet` WHERE `Configure`=1'); while ($Subnet = $DbResult->fetch_assoc()) { echo($Subnet['DHCP']); $Routerboard->HostName = $Subnet['DHCP']; $Items = array(); $Server = 'dhcp'.$Subnet['Id']; $DbResult2 = $this->Database->query('SELECT `NetworkInterface`.*, `NetworkDevice`.`Name` AS `DeviceName` FROM `NetworkInterface` '. 'LEFT JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device` '. 'WHERE CompareNetworkPrefix(INET_ATON(`LocalIP`), INET_ATON("'.$Subnet['AddressRange'].'"), '.$Subnet['Mask'].') '. 'AND (`MAC` != "00:00:00:00:00:00") ORDER BY `LocalIP`'); while ($Interface = $DbResult2->fetch_assoc()) { $Name = $Interface['DeviceName']; if ($Interface['Name'] != '') $Name .= '-'.$Interface['Name']; $Items[] = array('mac-address' => $Interface['MAC'], 'address' => $Interface['LocalIP'], 'server' => $Server, 'comment' => $Name, 'lease-time' => '1d00:00:00'); } print_r($Routerboard->ListUpdate($Path, array('mac-address', 'address', 'server', 'comment', 'lease-time'), $Items, array('server' => $Server, 'dynamic' => 'no'))); echo("\n"); } } }