";
##############################################
# DHCP Service CN (DN)
if ( $oldcn == $cn ){
# $mesg = "keine Aenderung "; } if ( $oldcn != "" && $cn != "" && $oldcn != $cn ){ echo "DHCP Service Name aendern "; # hier noch Syntaxcheck # Formulareingaben anpassen $exp = explode(" ",$cn); foreach ($exp as $word){$expuc[] = ucfirst($word);} $cn = implode(" ",$expuc); $cn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $cn); $newdhcpDN = "cn=".$cn.",".$nodeDN; print_r($newdhcpDN); echo " "; if(move_subtree($dhcpDN, $newdhcpDN)){ adjust_dhcpservice_dn($newdhcpDN, $dhcpDN); $dhcpDN = $newdhcpDN; $mesg = "DHCP Service Name erfolgreich geändert "; }else{ $mesg = "Fehler beim ändern des DHCP Service Namen! "; } } if ( $oldcn != "" && $cn == "" ){ echo "DHCP Service Name loeschen! Dieser ist Teil des DN, Sie werden den DHCP Service komplett löschen "; echo "Wollen Sie den DHCP Service ".$oldcn." wirklich löschen? "; $seconds = 600; } ##################################### # Offer ändern if ( $dhcpoffer != "none" ){ if ( $dhcpoffer != "off" && $dhcpoffer == $olddhcpoffer ){ $mesg = "Sie haben die gleiche Abteilung ausgewählt Keine Änderung!"; } if ( $dhcpoffer != "off" && $dhcpoffer != $olddhcpoffer ){ $entryoffer ['dhcpofferdn'] = $dhcpoffer; if(ldap_mod_replace($ds,$dhcpDN,$entryoffer)){ $mesg = "DHCP Service Offer erfolgreich geändert "; } else{ $mesg = "Fehler beim ändern des DHCP Service Offers! "; } } /*if ( $dhcpoffer == "off" && $olddhcpoffer != "" ){ $entryoffer ['dhcpofferdn'] = array(); if(ldap_mod_del($ds,$dhcpDN,$entryoffer)){ $mesg = "DHCP Service Offer erfolgreich geändert "; } else{ $mesg = "Fehler beim ändern des DHCP Service Offers! "; } }*/ } ##################################### # Selbstdefinierte Optionen if ( $adddhcpoptdefinition != "" ){ echo "Selbst-definierte DHCP Option hinzufügen. "; $entryadd['optiondefinition'] = $adddhcpoptdefinition; if(ldap_mod_add($ds,$dhcpDN,$entryadd)){ $mesg = "Selbst-definierte DHCP Option erfolgreich eingetragen "; }else{ $mesg = "Fehler beim eintragen Selbst-definierte DHCP Option "; } } #todo: array_vergleich -> Ă„nderung -> ldap_modify #print_r($dhcpoptdefinition);echo " "; #print_r($olddhcpoptdefinition);echo " "; ##################################### # Restliche Attribute $entryadd = array(); $entrymod = array(); $entrydel = array(); foreach (array_keys($atts) as $key){ if ( $oldatts[$key] == $atts[$key] ){ } if ( $oldatts[$key] == "" && $atts[$key] != "" ){ # hier noch Syntaxcheck $entryadd[$key] = $atts[$key]; } if ( $oldatts[$key] != "" && $atts[$key] != "" && $oldatts[$key] != $atts[$key] ){ # hier noch Syntaxcheck $entrymod[$key] = $atts[$key]; } if ( $oldatts[$key] != "" && $atts[$key] == "" ){ # hier noch Syntaxcheck $entrydel[$key] = $oldatts[$key]; } } if (count($entryadd) != 0 ){ foreach (array_keys($entryadd) as $key){ $addatts .= "".$key.","; } if(ldap_mod_add($ds,$dhcpDN,$entryadd)){ $mesg = "Attribute ".$addatts." erfolgreich eingetragen "; }else{ $mesg = "Fehler beim eintragen der Attribute ".$addatts." "; } } if (count($entrymod) != 0 ){ foreach (array_keys($entrymod) as $key){ $modatts .= "".$key.","; } if(ldap_mod_replace($ds,$dhcpDN,$entrymod)){ $mesg = "Attribute ".$modatts." erfolgreich geaendert "; }else{ $mesg = "Fehler beim aendern der Attribute ".$modatts." "; } } if (count($entrydel) != 0 ){ foreach (array_keys($entrydel) as $key){ $delatts .= "".$key.","; } if(ldap_mod_del($ds,$dhcpDN,$entrydel)){ $mesg = "Attribute ".$delatts." erfolgreich geloescht "; }else{ $mesg = "Fehler beim loeschen der Attribute ".$delatts." "; } } $mesg .= " Sie werden automatisch auf die vorherige Seite zurückgeleitet. Falls nicht, klicken Sie hier back"; redirect($seconds, $url, $mesg, $addSessionId = TRUE); echo " |