summaryrefslogtreecommitdiffstats
path: root/ldap-site-mngmt/webinterface/computers/hwhost_change.php
diff options
context:
space:
mode:
Diffstat (limited to 'ldap-site-mngmt/webinterface/computers/hwhost_change.php')
-rw-r--r--ldap-site-mngmt/webinterface/computers/hwhost_change.php127
1 files changed, 127 insertions, 0 deletions
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 @@
+<?php
+include('../standard_header.inc.php');
+
+$syntax = new Syntaxcheck;
+
+$hostDN = $_POST['hostdn'];
+$sbmnr = $_POST['sbmnr'];
+
+# sonstige Attribute
+$attribs = $_POST['attribs'];
+if (count($attribs) != 0){
+ foreach (array_keys($attribs) as $key){
+ $atts[$key] = htmlentities($attribs[$key]);
+ }
+}
+#print_r($atts); echo "<br><br>";
+$oldattribs = $_POST['oldattribs'];
+if (count($oldattribs) != 0){
+ foreach (array_keys($oldattribs) as $key){
+ $oldatts[$key] = htmlentities($oldattribs[$key]);
+ }
+}
+#print_r($oldatts); echo "<br><br>";
+
+/*
+echo "new hostname:"; print_r($hostname); echo "<br>";
+echo "old hostname:"; print_r($oldhostname); echo "<br>";
+echo "new mac:"; print_r($mac); echo "<br>";
+echo "old mac:"; print_r($oldmac); echo "<br>";
+echo "new ip:"; print_r($ip); echo "<br>";
+echo "old ip:"; print_r($oldip); echo "<br>";
+echo "new desc:"; print_r($desc); echo "<br>";
+echo "old desc:"; print_r($olddesc); echo "<br><br>";
+echo "Host DN:"; print_r($hostDN); echo "<br>";
+echo "submenuNR:"; print_r($submenu); echo "<br><br>";
+*/
+
+$seconds = 2;
+$url = 'host.php?dn='.$hostDN.'&sbmnr='.$sbmnr;
+
+echo "
+<html>
+<head>
+ <title>AU Management</title>
+ <link rel='stylesheet' href='../styles.css' type='text/css'>
+</head>
+<body>
+<table border='0' cellpadding='30' cellspacing='0'>
+<tr><td>";
+
+####################################
+# restliche Attribute
+
+$entryadd = array();
+$entrymod = array();
+$entrydel = array();
+
+foreach (array_keys($atts) as $key){
+
+ if ( $oldatts[$key] == $atts[$key] ){
+ #$mesg = "keine Aenderung<br>";
+ }
+ 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 "<br>";
+#print_r($entrymod); echo "<br>";
+#print_r($entrydel); echo "<br>";
+
+if (count($entryadd) != 0 ){
+ #print_r($entryadd); echo "<br>";
+ #echo "neu anlegen<br>";
+ foreach (array_keys($entryadd) as $key){
+ $addatts .= "<b>".$key."</b>,";
+ }
+ if(ldap_mod_add($ds,$hostDN,$entryadd)){
+ $mesg = "Attribute ".$addatts." erfolgreich eingetragen<br><br>";
+ }else{
+ $mesg = "Fehler beim eintragen der Attribute ".$addatts."<br><br>";
+ }
+}
+
+if (count($entrymod) != 0 ){
+ #print_r($entrymod); echo "<br>";
+ #echo "&auml;ndern<br>";
+ foreach (array_keys($entrymod) as $key){
+ $modatts .= "<b>".$key."</b>,";
+ }
+ if(ldap_mod_replace($ds,$hostDN,$entrymod)){
+ $mesg = "Attribute ".$modatts." erfolgreich geaendert<br><br>";
+ }else{
+ $mesg = "Fehler beim aendern der Attribute ".$modatts."<br><br>";
+ }
+}
+
+if (count($entrydel) != 0 ){
+ #print_r($entrydel); echo "<br>";
+ #echo "l&ouml;schen<br>";
+ foreach (array_keys($entrydel) as $key){
+ $delatts .= "<b>".$key."</b>,";
+ }
+ if(ldap_mod_del($ds,$hostDN,$entrydel)){
+ $mesg = "Attribute ".$delatts." erfolgreich geloescht<br><br>";
+ }else{
+ $mesg = "Fehler beim loeschen der Attribute ".$delatts."<br><br>";
+ }
+}
+
+
+
+$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zur&uuml;ckgeleitet. <br>
+ Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>";
+redirect($seconds, $url, $mesg, $addSessionId = TRUE);
+
+echo "</td></tr></table></body>
+</html>";
+?> \ No newline at end of file