コード例 #1
0
    echo "Löschen: ";
    print_r($entrydeltr);
    echo "<br>";
    if ($result = ldap_mod_del($ds, $pxeDN, $entrydeltr)) {
        $mesg = "TimeRanges erfolgreich gel&ouml;scht<br><br>";
    } else {
        $mesg = "Fehler beim l&ouml;schen der TimeRanges!<br><br>";
    }
} elseif (count($deltr) != 0 && $modtr == 1) {
    echo "Nur &Auml;ndern (gleichzeitig L&ouml;schen und &Auml;ndern geht nicht)";
}
#####################################
# TimeRange hinzufügen
if ($newpxeday != "" && $newpxebeg != "" && $newpxeend != "" && $newpxebeg <= $newpxeend) {
    # TimeRange Syntax checken
    $syntax = new Syntaxcheck();
    if ($syntax->check_timerange_syntax($newpxeday, $newpxebeg, $newpxeend)) {
        # in Grossbuchstaben
        if (preg_match("/([a-z]+)/", $newpxeday)) {
            $newpxeday = strtoupper($newpxeday);
        }
        if (preg_match("/([a-z]+)/", $newpxebeg)) {
            $newpxebeg = strtoupper($newpxebeg);
        }
        if (preg_match("/([a-z]+)/", $newpxeend)) {
            $newpxeend = strtoupper($newpxeend);
        }
        # führende Nullen weg
        $newpxebeg = preg_replace('/0([0-9])/', '$1', $newpxebeg);
        $newpxeend = preg_replace('/0([0-9])/', '$1', $newpxeend);
        # TimeRange auf Überschneidung mit vorhandenen checken
コード例 #2
0
<?php

include '../standard_header.inc.php';
$hostDN = $_POST['hostdn'];
$oldip = $_POST['oldip'];
$newip = $_POST['newip'];
$fixadd = $_POST['fixadd'];
$dhcp = $_POST['dhcp'];
$olddhcp = $_POST['olddhcp'];
$rbs = $_POST['rbs'];
$oldrbs = $_POST['oldrbs'];
$dhcpsrv_dn = $_POST['dhcpsrv_dn'];
$syntax = new Syntaxcheck();
$url = "ip_rechner.php";
$dhcpchange = 0;
echo "\n<html>\n<head>\n\t<title>IP Address Management</title>\n\t<link rel='stylesheet' href='../styles.css' type='text/css'>\n</head>\n<body>\n<table border='0' cellpadding='30' cellspacing='0'> \n<tr valign='top'><td width='33%' class='tab_d'>";
#print_r($dhcpsrv_dn); echo "<br><br>";
#print_r($dhcp); echo "<br><br>";
#print_r($olddhcp); echo "<br><br>";
#print_r($newip); echo "<br><br>";
#print_r($oldip); echo "<br><br>";
#print_r($hostDN); echo "<br><br>";
# IP Adressen
echo "<br><b>IP Adressen:</b> <br><br>";
$diff1 = array_keys(array_diff_assoc($oldip, $newip));
$diff2 = array_keys(array_diff_assoc($newip, $oldip));
$tochange = array_unique(array_merge($diff1, $diff2));
#print_r($tochange); echo "<br><br>";
foreach ($tochange as $i) {
    $hostexp = ldap_explode_dn($hostDN[$i], 1);
    echo "<b>{$hostexp['0']}</b> - ";
コード例 #3
0
<?php

include '../standard_header.inc.php';
$syntax = new Syntaxcheck();
$subnet = $_POST['dhcpsubnet'];
$subnetexp = explode("|", $subnet);
$cn = $subnetexp[0];
$netmask = $subnetexp[1];
#print_r($subnet); echo "<br><br>";
#print_r($cn); echo "<br><br>";
#print_r($netmask); echo "<br><br>";
$dhcpservice = $_POST['dhcpservice'];
$maxlease = $_POST['dhcpoptmax-lease-time'];
$defaultlease = $_POST['dhcpoptdefault-lease-time'];
#$range1 = $_POST['range1'];
#$range2 = $_POST['range2'];
# sonstige Attribute
$attribs = $_POST['attribs'];
if (count($attribs) != 0) {
    foreach (array_keys($attribs) as $key) {
        $atts[$key] = htmlentities($attribs[$key]);
    }
}
if ($maxlease) {
    $atts['dhcpoptmax-lease-time'] = htmlentities($maxlease);
}
if ($defaultlease) {
    $atts['dhcpoptdefault-lease-time'] = htmlentities($defaultlease);
}
#print_r($atts); echo "<br><br>";
$nodeDN = "cn=dhcp," . $auDN;
コード例 #4
0
<?php

include '../standard_header.inc.php';
$syntax = new Syntaxcheck();
$hostDN = $_POST['hostdn'];
$hostname = $_POST['hostname'];
$oldhostname = $_POST['oldhostname'];
$mac = $_POST['mac'];
$oldmac = $_POST['oldmac'];
$ip = $_POST['ip'];
$oldip = $_POST['oldip'];
$dhcp = $_POST['dhcpcont'];
$olddhcp = $_POST['olddhcp'];
$fixedaddress = $_POST['fixadd'];
$oldfixedaddress = $_POST['oldfixadd'];
$rbs = $_POST['rbs'];
$oldrbs = $_POST['oldrbs'];
$desc = $_POST['desc'];
$olddesc = $_POST['olddesc'];
$sbmnr = $_POST['sbmnr'];
$hostname = htmlentities($hostname);
$oldhostname = htmlentities($oldhostname);
$mac = htmlentities($mac);
$mac = strtolower($mac);
$oldmac = htmlentities($oldmac);
$ip = htmlentities($ip);
$oldip = htmlentities($oldip);
$desc = htmlentities($desc);
$olddesc = htmlentities($olddesc);
$dhcp = htmlentities($dhcp);
$olddhcp = htmlentities($olddhcp);
コード例 #5
0
<?php

include '../standard_header.inc.php';
$syntax = new Syntaxcheck();
$pooldn = $_POST['pooldn'];
$poolaudn = $_POST['poolaudn'];
#echo "POOL AUDN: $poolaudn <br><br>";
$subnet = $_POST['subnet'];
$subnetau = $_POST['subnetau'];
$subnetaudn = $_POST['subnetaudn'];
$subnetdn = $_POST['subnetdn'];
$oldsubnetdn = $_POST['oldsubnetdn'];
#echo "subnetdn: $subnetdn<br>";
#echo "oldsubnetdn: $oldsubnetdn<br>";
#$delpool = $_POST['delpool'];
$range1 = $_POST['range1'];
$range2 = $_POST['range2'];
$oldrange1 = $_POST['oldrange1'];
$oldrange2 = $_POST['oldrange2'];
$addrange1 = $_POST['addrange1'];
$addrange2 = $_POST['addrange2'];
$pcl = $_POST['pcl'];
$oldpcl = $_POST['oldpcl'];
$rbs = $_POST['rbs'];
$oldrbs = $_POST['oldrbs'];
# sonstige Attribute
$attribs = $_POST['attribs'];
if (count($attribs) != 0) {
    foreach (array_keys($attribs) as $key) {
        $atts[$key] = htmlentities($attribs[$key]);
    }
コード例 #6
0
<?php

include '../standard_header.inc.php';
$syntax = new Syntaxcheck();
$audn = $_POST['audn'];
$auzone = $_POST['auzone'];
$oldauzone = $_POST['oldauzone'];
$seconds = 2;
$url = 'dns_au_zones.php?';
echo "\n\t<html>\n\t<head>\n\t\t<title>DNS Management</title>\n\t\t<link rel='stylesheet' href='../styles.css' type='text/css'>\n\t</head>\n\t<body>\n\t<table border='0' cellpadding='30' cellspacing='0'>\n\t<tr><td>";
#######################################
# AU - Zone Zuordnung
for ($i = 0; $i < count($auzone); $i++) {
    $auzone[$i] = strtolower($auzone[$i]);
    $oldauzone[$i] = strtolower($oldauzone[$i]);
    #echo "<br>$i| new: $auzone[$i] | ";
    #echo "old: $oldauzone[$i] | dn: $audn[$i]<br>";
    $change_zone = 1;
    $expou = ldap_explode_dn($audn[$i], 1);
    if ($auzone[$i] != $oldauzone[$i]) {
        if (!$oldauzone[$i]) {
            # Zone eintragen
            if ($syntax->is_hostname($auzone[$i])) {
                # if AU IP Ranges ... DNS Lookup Test
                $mipbs = get_maxipblocks_au($audn[$i]);
                if ($mipbs[0] != "") {
                    foreach ($mipbs as $mipb) {
                        $exp = explode("_", $mipb);
                        if (!check_iprange_zone($exp[0], $exp[1], $auzone[$i], $expou[0])) {
                            $change_zone = 0;
                        }
コード例 #7
0
<?php

include '../standard_header.inc.php';
$syntax = new Syntaxcheck();
#$auDN = $_POST['audn'];
$childauDN = $_POST['childdn'];
$childzone = $_POST['childzone'];
$oldrange1 = $_POST['oldrange1'];
$oldrange2 = $_POST['oldrange2'];
$newrange1 = $_POST['range1'];
$newrange2 = $_POST['range2'];
$childaudnexp = ldap_explode_dn($childauDN, 1);
$childau = $childaudnexp[0];
#print_r($childau);
/*
print_r($oldrange1);echo "<br>";
print_r($newrange1);echo "<br><br>";
print_r($oldrange2);echo "<br>";
print_r($newrange2);echo "<br>";
print_r($childauDN);echo "<br>";
print_r($childau);echo "<br>";
print_r($childzone);echo "<br>";
print_r($auDN);echo "<br><br>";
*/
$url = "child_au.php?cau=" . $childau;
$seconds = 5;
echo "\n<html>\n<head>\n\t<title>IP Address Management</title>\n\t<link rel='stylesheet' href='../styles.css' type='text/css'>\n</head>\n<body>\n<table border='0' cellpadding='30' cellspacing='0'>\n<tr><td>";
$diff1 = array_keys(array_diff_assoc($oldrange1, $newrange1));
$diff2 = array_keys(array_diff_assoc($newrange1, $oldrange1));
$tochange1 = array_unique(array_merge($diff1, $diff2));
$diff3 = array_keys(array_diff_assoc($oldrange2, $newrange2));
コード例 #8
0
function add_host($hostDN, $hostname, $hostdesc, $mac, $ip, $atts, $dhcp)
{
    global $ds, $suffix, $auDN, $assocdom, $ldapError;
    $syntax = new Syntaxcheck();
    $mactest = 0;
    $entryhost['objectclass'][0] = "Host";
    $entryhost['objectclass'][1] = "dhcpHost";
    $entryhost['objectclass'][2] = "dhcpOptions";
    $entryhost['objectclass'][3] = "top";
    $entryhost["hostname"] = $hostname;
    $entryhost["domainname"] = $assocdom;
    if ($hostdesc != "") {
        $entryhost["description"] = $hostdesc;
    }
    if ($mac != "") {
        if ($syntax->check_mac_syntax($mac)) {
            $entryhost["hwaddress"] = $mac;
            if ($dhcp != "none" && $dhcp != "") {
                $entryhost["dhcphlpcont"] = $dhcp;
            }
        } else {
            echo "SyntaxCheck MAC Adresse <b>{$mac}</b>:<br>-> " . $syntax->ERROR;
        }
    } else {
        echo "Keine MAC Adresse angelegt. Kein DHCP Eintrag.<br>";
    }
    foreach (array_keys($atts) as $key) {
        if ($atts[$key] != "") {
            $entryhost[$key] = $atts[$key];
        }
    }
    #print_r($entryhost); echo "<br>";
    if ($result = ldap_add($ds, $hostDN, $entryhost)) {
        if ($ip != "") {
            if ($syntax->check_ip_syntax($ip)) {
                $newip_array = array($ip, $ip);
                $newip = implode('_', $newip_array);
                print_r($newip);
                echo "<br><br>";
                if (new_ip_host($newip, $hostDN, $auDN)) {
                    echo "IP erfolgreich eingetragen<br><br>";
                    if ($mac != "" && $mactest && $dhcp != "none" && $dhcp != "") {
                        $entryfa["dhcpoptfixed-address"] = "ip";
                        if (ldap_mod_add($ds, $hostDN, $entryfa)) {
                            echo "DHCP Fixed-Address erfolgreich auf IP gesetzt<br><br>";
                        } else {
                            echo "Fehler beim Setzen von DHCP Fixed-Address<br><br>";
                        }
                    }
                } else {
                    echo "Fehler beim eintragen der IP<br><br>";
                }
            } else {
                echo "Falsche IP Syntax! IP nicht eingetragen<br><br>";
            }
        }
        #echo "Rechner erfolgreich eingetragen<br>";
        if ($mac != "" && $mactest && $dhcp != "none" && $dhcp != "") {
            update_dhcpmtime($auDN);
        }
        return 1;
    } else {
        #echo "Fehler beim eintragen des neuen Rechners!<br>";
        return 0;
    }
}
コード例 #9
0
<?php

include '../standard_header.inc.php';
$syntax = new Syntaxcheck();
$pooldn = $_POST['pooldn'];
$subnet = $_POST['subnet'];
$subnetau = $_POST['subnetau'];
$delpool = $_POST['delpool'];
$poolranges = array();
foreach ($pooldn as $dn) {
    $poolranges[$dn] = get_dhcppoolranges($dn);
}
$range1 = $_POST['range1'];
$range2 = $_POST['range2'];
$oldrange1 = $_POST['oldrange1'];
$oldrange2 = $_POST['oldrange2'];
$rangepooldn = $_POST['rangepooldn'];
$addrange1 = $_POST['addrange1'];
$addrange2 = $_POST['addrange2'];
$uc = $_POST['unknownclients'];
$olduc = $_POST['olduc'];
$rbs = $_POST['rbs'];
$oldrbs = $_POST['oldrbs'];
# Array to fill with AUs to update dhcpMTime
$au_to_update = array();
$mnr = $_POST['mnr'];
#print_r($pooldn); echo "<br>";
#print_r($subnet); echo "<br>";
#print_r($subnetau); echo "<br>";
#print_r($delpool); echo "<br><br>";
#print_r($oldrange1); echo "<br>";
コード例 #10
0
<?php

include '../standard_header.inc.php';
$syntax = new Syntaxcheck();
$rbscn = "RBS_" . $_POST['rbscn'];
$oldrbscn = "RBS_" . $_POST['oldrbscn'];
$tftpserverip = $_POST['tftpserverip'];
$oldtftpserverip = $_POST['oldtftpserverip'];
$rbsoffer = $_POST['rbsoffer'];
$oldrbsoffer = $_POST['oldrbsoffer'];
$tftpserver = $_POST['tftpserver'];
$oldtftpserverdn = $_POST['oldtftpserverdn'];
$host_array = get_hosts($auDN, array("dn", "hostname", "ipaddress"));
$rbsDN = $_POST['rbsdn'];
$nodeDN = "cn=rbs," . $auDN;
$mnr = $_POST['mnr'];
$sbmnr = $_POST['sbmnr'];
$mcnr = $_POST['mcnr'];
# sosntige 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]);
    }
コード例 #11
0
<?php

include '../standard_header.inc.php';
$syntax = new Syntaxcheck();
$hostname = $_POST['hostname'];
$hostdesc = $_POST['hostdesc'];
$mac = $_POST['mac'];
$ip = $_POST['ip'];
$dhcp = $_POST['dhcpcont'];
#$hostname = htmlentities($hostname);
$hostdesc = htmlentities($hostdesc);
$mac = htmlentities($mac);
$mac = strtolower($mac);
$ip = htmlentities($ip);
/* 
echo "AU dn:"; print_r($auDN); echo "<br>";
echo "hostname:"; print_r($hostname); echo "<br>";
echo "hostdesc:"; print_r($hostdesc); echo "<br>";
echo "mac:"; print_r($mac); echo "<br>";
echo "ip:"; print_r($ip); echo "<br><br>";
*/
$attribs = $_POST['attribs'];
if (count($attribs) != 0) {
    foreach (array_keys($attribs) as $key) {
        $atts[$key] = htmlentities($attribs[$key]);
    }
}
$automatic_back = 1;
$seconds = 2;
echo "\n<html>\n<head>\n\t<title>AU Management</title>\n\t<link rel='stylesheet' href='../styles.css' type='text/css'>\n</head>\n<body>\n<table border='0' cellpadding='30' cellspacing='0'> \n<tr><td>";
if ($hostname != "") {
コード例 #12
0
<?php

include '../standard_header.inc.php';
$syntax = new Syntaxcheck();
$ipnet = $_POST['ip'];
#print_r($ipnet);
$childauDN = $_POST['childdn'];
$childzone = $_POST['childzone'];
$only_subnet = $_POST['only_subnet'];
$childaudnexp = ldap_explode_dn($childauDN, 1);
$childau = $childaudnexp[0];
#print_r($childau);
$url = "child_au.php?cau=" . $childau;
$seconds = 2;
echo "\n<html>\n<head>\n\t<title>IP Address Management</title>\n\t<link rel='stylesheet' href='../styles.css' type='text/css'>\n</head>\n<body>\n<table border='0' cellpadding='20' cellspacing='0' width='100%'>\n<tr><td>";
$net = implode(".", $ipnet) . ".0";
if ($syntax->check_ip_syntax($net) && $ipnet[0] != "0") {
    #echo "<b>$net</b><br>";
    if ($only_subnet) {
        $mipb = $net . "_" . $net;
    } else {
        $mipb = $net . "_" . implode(".", $ipnet) . ".255";
    }
    #echo "<b>$mipb</b><br>";
    if (!($ou = check_for_existing_mipbs($mipb))) {
        #echo "Netz <b>$net</b> anlegen ...<br><br>";
        # MIPB und FIPB in ChildAU eintragen
        $childau_entry['MaxIPBlock'] = $mipb;
        $childau_entry['FreeIPBlock'] = $mipb;
        if (ldap_mod_add($ds, $childauDN, $childau_entry)) {
            $seconds = 500;