summaryrefslogtreecommitdiffstats
path: root/ldap-site-mngmt/webinterface/dhcp/new_dhcpsubnet.php
blob: 2d2835ec71f7761f79f2b0a87e95dd217754ee09 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php

include('../standard_header.inc.php');

# Dateiname und evtl. Pfad des Templates für die Webseite
$webseite = "new_dhcpsubnet.dwt";

include('dhcp_header.inc.php');

$mnr = 0; 
$sbmnr = -1;

###################################################################################

$mnr = $_GET['mnr'];
$sbmnr = $_GET['sbmnr'];

# Menuleisten erstellen
createMainMenu($rollen, $mainnr);
createDhcpMenu($rollen, $mnr, $auDN, $sbmnr);

###################################################################################

$subnetcn = str_replace ( "_", " ", $_GET['subnetcn']);
$netmask = str_replace ( "_", " ", $_GET['netmask']);
$template->assign(array("CN" => $subnetcn,
								"NETMASK" => $netmask,
								"DESCRIPTION" => "",
								"STATEMENTS" => "",
								"ALLOW" => "",
								"DENY" => "",
								"IGNORE" => "",
								"DDNSUPDATE" => "",
								"DEFAULTLEASE" => "",
								"MAXLEASE" => "",
								"USEHOSTDCL" => "",
								"BROADCAST" => "",
								"ROUTERS" => "",
								"DOMAINNAME" => "",
								"DOMAINNAMESERVERS" => "",
								"NEXTSERVER" => "",
								"FILENAME" => "",
								"SRVIDENT" => "",
								"NTPSERVERS" => "",
								"OPTGENERIC" => "",
								"DHCPSVNOW" => "",
								"DHCPSVNOWAU" => "",
           		       	"MNR" => $mnr,
           		       	"SBMNR" => $sbmnr,
           		       	"MCNR" => $mcnr));



$freenets = get_networks();
#print_r($freenets);
$subnets = array();
if (count($freenets) != 0){
   $template->define_dynamic("Dhcpsubnets", "Webseite");

   foreach ($freenets as $subnet){
      $netexp = explode(".",$subnet);
      $mask = array(255,255,255,255);
      for ($i=0; $i<count($netexp); $i++){
         if ($netexp[$i] == "0"){
            $mask[$i] = "0";
         }
      }
      $netmask = implode(".", $mask);
      $subnets[] = $subnet."|".$netmask;
      
      $template->assign(array("SUBNET" => $subnet."|".$netmask,
   	                  "CN" => $subnet,
   	                  "NETMASK" => $netmask));
   	$template->parse("DHCPSUBNETS_LIST", ".Dhcpsubnets");	  
   }
   #print_r($subnets);
   
# DHCP Services
$dhcpservices = get_dhcpoffers($auDN);
#print_r($dhcpservices); echo "<br>";

$template->assign(array("DHCPSVDN" => "",
   	                  "DHCPSVCN" => "",
   	                  "DHCPSVAU" => ""));
if (count($dhcpservices) != 0){
$template->define_dynamic("Dhcpservices", "Webseite");
	foreach ($dhcpservices as $item){
	   $exp = ldap_explode_dn($item,1);

		$template->assign(array("DHCPSVDN" => $item,
   	                  "DHCPSVCN" => $exp[0],
   	                  "DHCPSVAU" => $exp[2]));
   	$template->parse("DHCPSERVICES_LIST", ".Dhcpservices");	
	} 
}

$template->assign(array("SUBLIST" => count($freenets)+1,
								"SRVLIST" => count($dhcpservices)+1));

}else{
   # keine freie Netze mehr zur Verfügung
   # wird schon über das DHCP Menu abgefangen ...
}

###################################################################################

include("dhcp_footer.inc.php");

?>