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/hwhost_change.php | 127 +++++++++++++++++++++
1 file changed, 127 insertions(+)
create mode 100644 ldap-site-mngmt/webinterface/computers/hwhost_change.php
(limited to 'ldap-site-mngmt/webinterface/computers/hwhost_change.php')
diff --git a/ldap-site-mngmt/webinterface/computers/hwhost_change.php b/ldap-site-mngmt/webinterface/computers/hwhost_change.php
new file mode 100644
index 00000000..7b93f7c9
--- /dev/null
+++ b/ldap-site-mngmt/webinterface/computers/hwhost_change.php
@@ -0,0 +1,127 @@
+
";
+$oldattribs = $_POST['oldattribs'];
+if (count($oldattribs) != 0){
+ foreach (array_keys($oldattribs) as $key){
+ $oldatts[$key] = htmlentities($oldattribs[$key]);
+ }
+}
+#print_r($oldatts); echo "
";
+
+/*
+echo "new hostname:"; print_r($hostname); echo "
";
+echo "old hostname:"; print_r($oldhostname); echo "
";
+echo "new mac:"; print_r($mac); echo "
";
+echo "old mac:"; print_r($oldmac); echo "
";
+echo "new ip:"; print_r($ip); echo "
";
+echo "old ip:"; print_r($oldip); echo "
";
+echo "new desc:"; print_r($desc); echo "
";
+echo "old desc:"; print_r($olddesc); echo "
";
+echo "Host DN:"; print_r($hostDN); echo "
";
+echo "submenuNR:"; print_r($submenu); echo "
";
+*/
+
+$seconds = 2;
+$url = 'host.php?dn='.$hostDN.'&sbmnr='.$sbmnr;
+
+echo "
+
+
| ";
+
+####################################
+# restliche Attribute
+
+$entryadd = array();
+$entrymod = array();
+$entrydel = array();
+
+foreach (array_keys($atts) as $key){
+
+ if ( $oldatts[$key] == $atts[$key] ){
+ #$mesg = "keine Aenderung "; + } + 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]; + } +} +#print_r($entryadd); echo " "; +#print_r($entrymod); echo " "; +#print_r($entrydel); echo " "; + +if (count($entryadd) != 0 ){ + #print_r($entryadd); echo " "; + #echo "neu anlegen "; + foreach (array_keys($entryadd) as $key){ + $addatts .= "".$key.","; + } + if(ldap_mod_add($ds,$hostDN,$entryadd)){ + $mesg = "Attribute ".$addatts." erfolgreich eingetragen "; + }else{ + $mesg = "Fehler beim eintragen der Attribute ".$addatts." "; + } +} + +if (count($entrymod) != 0 ){ + #print_r($entrymod); echo " "; + #echo "ändern "; + foreach (array_keys($entrymod) as $key){ + $modatts .= "".$key.","; + } + if(ldap_mod_replace($ds,$hostDN,$entrymod)){ + $mesg = "Attribute ".$modatts." erfolgreich geaendert "; + }else{ + $mesg = "Fehler beim aendern der Attribute ".$modatts." "; + } +} + +if (count($entrydel) != 0 ){ + #print_r($entrydel); echo " "; + #echo "löschen "; + foreach (array_keys($entrydel) as $key){ + $delatts .= "".$key.","; + } + if(ldap_mod_del($ds,$hostDN,$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 " |