function get_used_ipblocks_au($au) { global $ds, $suffix, $ldapError; $host_ips = array(); $dhcps_ips = array(); $dhcpr_ips = array(); $deleg_ips = array(); # Rechner IPs if (!($result = uniLdapSearch($ds, "cn=computers," . $au, "(objectclass=Host)", array("IPAddress"), "", "list", 0, 0))) { # redirect(5, "", $ldapError, FALSE); echo "no search"; die; } else { $result = ldapArraySauber($result); foreach ($result as $item) { if (count($item['ipaddress']) != 0) { $host_ips[] = $item['ipaddress']; } } } echo "Rechner IPs:<br>"; print_r($host_ips); echo "<br><br>"; # DHCP Subnets if (!($result = uniLdapSearch($ds, "cn=dhcp," . $au, "(objectclass=dhcpSubnet)", array("cn"), "", "list", 0, 0))) { # redirect(5, "", $ldapError, FALSE); echo "no search"; die; } else { $result = ldapArraySauber($result); foreach ($result as $item) { $dhcps_ips[] = $item['cn'] . "_" . $item['cn']; } } echo "DHCP Subnets:<br>"; print_r($dhcps_ips); echo "<br><br>"; # DHCP Pool Ranges if (!($result = uniLdapSearch($ds, "cn=dhcp," . $au, "(objectclass=dhcpPool)", array("dhcpRange"), "", "list", 0, 0))) { # redirect(5, "", $ldapError, FALSE); echo "no search"; die; } else { $result = ldapArraySauber($result); foreach ($result as $item) { if (count($item['dhcprange']) > 1) { foreach ($item['dhcprange'] as $range) { $dhcpr_ips[] = $range; } } elseif (count($item['dhcprange']) == 1) { $dhcpr_ips[] = $item['dhcprange']; } } } echo "DHCP Pool Ranges:<br>"; print_r($dhcpr_ips); echo "<br><br>"; # Delegierte IPs $childau_array = get_childau($au, array("dn", "ou", "maxipblock")); #print_r($childau_array); if (count($childau_array) != 0) { foreach ($childau_array as $childau) { if (count($childau['maxipblock']) > 1) { foreach ($childau['maxipblock'] as $mipb) { $deleg_ips[] = $mipb; } } elseif (count($childau['maxipblock']) == 1) { $deleg_ips[] = $childau['maxipblock']; } } } echo "Delegiert IP Blocks:<br>"; print_r($deleg_ips); echo "<br><br>"; $used_ips = array_merge($host_ips, $dhcps_ips, $dhcpr_ips, $deleg_ips); sort($used_ips); $used_ips = merge_ipranges_array($used_ips); return $used_ips; }
$modpool['dhcprange'] = merge_ipranges_array($modpool['dhcprange']); print_r($modpool); echo "<br>"; if ($res = ldap_mod_replace($ds, $pdn, $modpool)) { printf("Pool Ranges von %s erfolgreich angepasst", $pdn); } else { printf("Fehler beim Anpassen der Pool Ranges von %s", $pdn); } } } $diff = array_diff($new_fipbs['freeipblock'], $fipbs); $revdiff = array_diff($fipbs, $new_fipbs['freeipblock']); if (count($diff) != 0 || count($revdiff) != 0) { echo "<br>FIPBS anpassen<br>"; #print_r($new_fipbs['freeipblock']); echo "<br>"; $new_fipbs['freeipblock'] = merge_ipranges_array($new_fipbs['freeipblock']); print_r($new_fipbs); echo "<br>"; if ($res = ldap_mod_replace($ds, $auDN, $new_fipbs)) { printf("FIPBs erfolgreich angepasst"); } else { printf("Fehler beim Anpassen der FIPBs"); } } ######################################################################################### # DHCP Modify Timestamps in betreffenden AUs aktualisieren #echo "<br>Subnet-AU: ";print_r ($au_to_update); echo "<br>"; update_dhcpmtime($au_to_update); $mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br>\t\t\t\t\n\t\t\tFalls nicht, klicken Sie hier <a href=" . $url . " style='publink'>back</a>"; redirect($seconds, $url, $mesg, $addSessionId = TRUE); echo "</td></tr></table></body>\n</html>";