From 59cf91925ca8da43d2427331b23e4673b0e53095 Mon Sep 17 00:00:00 2001
From: Tarik Gasmi
Date: Mon, 14 May 2007 08:03:48 +0000
Subject: Other webinterface data.
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1077 95ad53e4-c205-0410-b2fa-d234c58c8868
---
.../webinterface/computers/dhcphost_change.php | 177 +++++++++++++++++++++
1 file changed, 177 insertions(+)
create mode 100644 ldap-site-mngmt/webinterface/computers/dhcphost_change.php
(limited to 'ldap-site-mngmt/webinterface/computers/dhcphost_change.php')
diff --git a/ldap-site-mngmt/webinterface/computers/dhcphost_change.php b/ldap-site-mngmt/webinterface/computers/dhcphost_change.php
new file mode 100644
index 00000000..907fae8f
--- /dev/null
+++ b/ldap-site-mngmt/webinterface/computers/dhcphost_change.php
@@ -0,0 +1,177 @@
+";
+echo "old dhcp:"; print_r($olddhcp); echo "
";
+echo "new rbs:"; print_r($rbs); echo "
";
+echo "old rbs:"; print_r($oldrbs); echo "
";
+echo "Host DN:"; print_r($hostDN); echo "
";
+echo "submenuNR:"; print_r($sbmnr); echo "
";*/
+
+
+$seconds = 40;
+$url = 'dhcphost.php?dn='.$hostDN.'&sbmnr='.$sbmnr;
+
+echo "
+
+
| ";
+
+##########################################
+# DHCP
+
+if ($dhcp != "none" && $dhcp != $olddhcp){
+ if ($dhcp != ""){
+ $exp = ldap_explode_dn($dhcp, 1);
+ $dhcpcn = $exp[0];
+ $dhcpau = $exp[2];
+
+ $entrydhcp ['dhcphlpcont'] = $dhcp;
+ if ($olddhcp != ""){
+ echo "DHCP replace "; print_r($olddhcp); echo " with "; print_r($entrydhcp); echo " "; + if ($result = ldap_mod_replace($ds,$hostDN,$entrydhcp)){ + $mesg = "Rechner erfolgreich in DHCP ".$dhcpcn." [Abt.: ".$dhcpau."] angemeldet "; + }else{ + $mesg = "Fehler beim ändern des DHCP Dienstes zu ".$dhcpcn."! "; + } + }else{ + if ( $hostip != "" ){ + $entrydhcp ['dhcpoptfixed-address'] = "ip"; + } + echo "DHCP add "; print_r($entrydhcp); echo " "; + if ($result = ldap_mod_add($ds,$hostDN,$entrydhcp)){ + $mesg = "Rechner erfolgreich in DHCP ".$dhcpcn." [Abt.: ".$dhcpau."] angemeldet "; + }else{ + $mesg = "Fehler beim ändern des DHCP Dienstes zu ".$dhcpcn."! "; + } + } + }else{ + $entrydhcp ['dhcphlpcont'] = array(); + if ( $fixedaddress != "" ){ + $entrydhcp ['dhcpoptfixed-address'] = array(); + } + echo "DHCP delete "; echo " "; + if ($result = ldap_mod_del($ds,$hostDN,$entrydhcp)){ + $mesg = "Rechner erfolgreich aus DHCP gelöscht "; + }else{ + $mesg = "Fehler beim löschen aus DHCP Dienst! "; + } + } + +} +if ($dhcp == "none"){ + echo " DHCP none "; +} + +# DHCP Option fixed-address +if ($fixedaddress != "none" && $fixedaddress != $oldfixedaddress){ + if ($fixedaddress != ""){ + $entryfixadd ['dhcpoptfixed-address'] = $fixedaddress; + if ($oldfixedaddress != ""){ + echo "Fixed Address ändern"; echo " "; + if ($result = ldap_mod_replace($ds,$hostDN,$entryfixadd)){ + $mesg = "Option Fixed-Address erfolgreich auf ".$fixedaddress." geändert "; + }else{ + $mesg = "Fehler beim ändern der Option Fixed-Address auf ".$fixedaddress."! "; + } + }else{ + echo "Fixed Address auf IP Adresse setzen"; echo " "; + if ($result = ldap_mod_add($ds,$hostDN,$entryfixadd)){ + $mesg = "Option Fixed-Address erfolgreich auf ".$fixedaddress." gesetzt "; + }else{ + $mesg = "Fehler beim setzen der Option Fixed-Address auf ".$fixedaddress."! "; + } + } + }else{ + $entryfixadd ['dhcpoptfixed-address'] = array(); + echo "No Fixed Address"; echo " "; + if ($result = ldap_mod_del($ds,$hostDN,$entryfixadd)){ + $mesg = "Option Fixed-Address erfolgreich gelöscht "; + }else{ + $mesg = "Fehler beim löschen der Option Fixed-Address! "; + } + } +} + + +########################################## +# RBS + +if ($rbs != "none" && $rbs != $oldrbs){ + if ($rbs != ""){ + $exp = ldap_explode_dn($rbs, 1); + $rbscn = $exp[0]; + $rbsau = $exp[2]; + + $dhcpdata = get_node_data($rbs,array("tftpserverip","initbootfile")); + $entryrbs ['hlprbservice'] = $rbs; + $entryrbs ['dhcpoptnext-server'] = $dhcpdata['tftpserverip']; + $entryrbs ['dhcpoptfilename'] = $dhcpdata['initbootfile']; + if ($oldrbs != ""){ + echo "RBS replace "; print_r($oldrbs); echo " with "; print_r($entryrbs); echo " "; + if ($result = ldap_mod_replace($ds,$hostDN,$entryrbs)){ + rbs_adjust_host($hostDN, $rbs); + $mesg = "Remote Boot Service erfolgreich zu ".$rbscn." [Abt.: ".$rbsau."] geändert "; + }else{ + $mesg = "Fehler beim ändern des Remote Boot Services zu ".$rbscn."! "; + } + }else{ + echo "RBS add "; print_r($entryrbs); echo " "; + if ($result = ldap_mod_add($ds,$hostDN,$entryrbs)){ + rbs_adjust_host($hostDN, $rbs); + $mesg = "Remote Boot Service erfolgreich zu ".$rbscn." [Abt.: ".$rbsau."] geändert "; + }else{ + $mesg = "Fehler beim ändern des Remote Boot Services zu ".$rbscn."! "; + } + } + }else{ + $entryrbs ['hlprbservice'] = array(); + $entryrbs ['dhcpoptnext-server'] = array(); + $entryrbs ['dhcpoptfilename'] = array(); + echo "RBS delete "; echo " "; + if ($result = ldap_mod_del($ds,$hostDN,$entryrbs)){ + $mesg = "Rechner erfolgreich aus RBS gelöscht "; + }else{ + $mesg = "Fehler beim löschen aus RBS! "; + } + } +} +if ($rbs == "none"){ + echo "RBS none "; +} + + +##################### + +$mesg .= " Sie werden automatisch auf die vorherige Seite zurückgeleitet. + Falls nicht, klicken Sie hier back"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +echo " |