Project

General

Profile

Download (56.7 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	services_dhcp.php
5
	part of m0n0wall (http://m0n0.ch/wall)
6

    
7
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
8
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
9
	All rights reserved.
10

    
11
	Redistribution and use in source and binary forms, with or without
12
	modification, are permitted provided that the following conditions are met:
13

    
14
	1. Redistributions of source code must retain the above copyright notice,
15
	   this list of conditions and the following disclaimer.
16

    
17
	2. Redistributions in binary form must reproduce the above copyright
18
	   notice, this list of conditions and the following disclaimer in the
19
	   documentation and/or other materials provided with the distribution.
20

    
21
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
22
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
23
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
25
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
	POSSIBILITY OF SUCH DAMAGE.
31
*/
32
/*
33
	pfSense_BUILDER_BINARIES:	/bin/rm
34
	pfSense_MODULE:	interfaces
35
*/
36

    
37
##|+PRIV
38
##|*IDENT=page-services-dhcpserver
39
##|*NAME=Services: DHCP server page
40
##|*DESCR=Allow access to the 'Services: DHCP server' page.
41
##|*MATCH=services_dhcp.php*
42
##|-PRIV
43

    
44
require("guiconfig.inc");
45
require_once("filter.inc");
46

    
47
if(!$g['services_dhcp_server_enable']) {
48
	header("Location: /");
49
	exit;
50
}
51

    
52
$if = $_GET['if'];
53
if (!empty($_POST['if']))
54
	$if = $_POST['if'];
55

    
56
/* if OLSRD is enabled, allow WAN to house DHCP. */
57
if($config['installedpackages']['olsrd']) {
58
	foreach($config['installedpackages']['olsrd']['config'] as $olsrd) {
59
			if($olsrd['enable']) {
60
				$is_olsr_enabled = true;
61
				break;
62
			}
63
	}
64
}	
65

    
66
$iflist = get_configured_interface_with_descr();
67

    
68
/* set the starting interface */
69
if (!$if || !isset($iflist[$if])) {
70
	foreach ($iflist as $ifent => $ifname) {
71
		$oc = $config['interfaces'][$ifent];
72
		if ((is_array($config['dhcpd'][$ifent]) && !isset($config['dhcpd'][$ifent]['enable']) && (!is_ipaddrv4($oc['ipaddr']))) ||
73
			(!is_array($config['dhcpd'][$ifent]) && (!is_ipaddrv4($oc['ipaddr']))))
74
			continue;
75
		$if = $ifent;
76
		break;
77
	}
78
}
79

    
80
$act = $_GET['act'];
81
if (!empty($_POST['act']))
82
	$act = $_POST['act'];
83

    
84
$a_pools = array();
85

    
86
if (is_array($config['dhcpd'][$if])){
87
	$pool = $_GET['pool'];
88
	if (is_numeric($_POST['pool']))
89
		$pool = $_POST['pool'];
90

    
91
	// If we have a pool but no interface name, that's not valid. Redirect away.
92
	if (is_numeric($pool) && empty($if)) {
93
		header("Location: services_dhcp.php");
94
		exit;
95
	}
96

    
97
	if (!is_array($config['dhcpd'][$if]['pool']))
98
		$config['dhcpd'][$if]['pool'] = array();
99
	$a_pools = &$config['dhcpd'][$if]['pool'];
100

    
101
	if (is_numeric($pool) && $a_pools[$pool])
102
		$dhcpdconf = &$a_pools[$pool];
103
	elseif ($act == "newpool")
104
		$dhcpdconf = array();
105
	else
106
		$dhcpdconf = &$config['dhcpd'][$if];
107
}
108
if (is_array($dhcpdconf)) {
109
	// Global Options
110
	if (!is_numeric($pool) && !($act == "newpool")) {
111
		$pconfig['enable'] = isset($dhcpdconf['enable']);
112
		$pconfig['staticarp'] = isset($dhcpdconf['staticarp']);
113
		// No reason to specify this per-pool, per the dhcpd.conf man page it needs to be in every
114
		//   pool and should be specified in every pool both nodes share, so we'll treat it as global
115
		$pconfig['failover_peerip'] = $dhcpdconf['failover_peerip'];
116

    
117
		// dhcpleaseinlocaltime is global to all interfaces. So if it is selected on any interface,
118
		// then show it true/checked.
119
		foreach ($config['dhcpd'] as $dhcpdifitem) {
120
			$dhcpleaseinlocaltime = $dhcpdifitem['dhcpleaseinlocaltime'];
121
			if ($dhcpleaseinlocaltime)
122
				break;
123
		}
124

    
125
		$pconfig['dhcpleaseinlocaltime'] = $dhcpleaseinlocaltime;
126

    
127
		if (!is_array($dhcpdconf['staticmap']))
128
			$dhcpdconf['staticmap'] = array();
129
		$a_maps = &$dhcpdconf['staticmap'];
130
	} else {
131
		// Options that exist only in pools
132
		$pconfig['descr'] = $dhcpdconf['descr'];
133
	}
134

    
135
	// Options that can be global or per-pool.
136
	if (is_array($dhcpdconf['range'])) {
137
		$pconfig['range_from'] = $dhcpdconf['range']['from'];
138
		$pconfig['range_to'] = $dhcpdconf['range']['to'];
139
	}
140
	$pconfig['deftime'] = $dhcpdconf['defaultleasetime'];
141
	$pconfig['maxtime'] = $dhcpdconf['maxleasetime'];
142
	$pconfig['gateway'] = $dhcpdconf['gateway'];
143
	$pconfig['domain'] = $dhcpdconf['domain'];
144
	$pconfig['domainsearchlist'] = $dhcpdconf['domainsearchlist'];
145
	list($pconfig['wins1'],$pconfig['wins2']) = $dhcpdconf['winsserver'];
146
	list($pconfig['dns1'],$pconfig['dns2'],$pconfig['dns3'],$pconfig['dns4']) = $dhcpdconf['dnsserver'];
147
	$pconfig['denyunknown'] = isset($dhcpdconf['denyunknown']);
148
	$pconfig['ddnsdomain'] = $dhcpdconf['ddnsdomain'];
149
	$pconfig['ddnsdomainprimary'] = $dhcpdconf['ddnsdomainprimary'];
150
	$pconfig['ddnsdomainkeyname'] = $dhcpdconf['ddnsdomainkeyname'];
151
	$pconfig['ddnsdomainkey'] = $dhcpdconf['ddnsdomainkey'];
152
	$pconfig['ddnsupdate'] = isset($dhcpdconf['ddnsupdate']);
153
	$pconfig['mac_allow'] = $dhcpdconf['mac_allow'];
154
	$pconfig['mac_deny'] = $dhcpdconf['mac_deny'];
155
	list($pconfig['ntp1'],$pconfig['ntp2']) = $dhcpdconf['ntpserver'];
156
	$pconfig['tftp'] = $dhcpdconf['tftp'];
157
	$pconfig['ldap'] = $dhcpdconf['ldap'];
158
	$pconfig['netboot'] = isset($dhcpdconf['netboot']);
159
	$pconfig['nextserver'] = $dhcpdconf['nextserver'];
160
	$pconfig['filename'] = $dhcpdconf['filename'];
161
	$pconfig['filename32'] = $dhcpdconf['filename32'];
162
	$pconfig['filename64'] = $dhcpdconf['filename64'];
163
	$pconfig['rootpath'] = $dhcpdconf['rootpath'];
164
	$pconfig['netmask'] = $dhcpdconf['netmask'];
165
	$pconfig['numberoptions'] = $dhcpdconf['numberoptions'];
166
}
167

    
168
$ifcfgip = $config['interfaces'][$if]['ipaddr'];
169
$ifcfgsn = $config['interfaces'][$if]['subnet'];
170

    
171
function validate_partial_mac_list($maclist) {
172
	$macs = explode(',', $maclist);
173

    
174
	// Loop through and look for invalid MACs.
175
	foreach ($macs as $mac)
176
		if (!is_macaddr($mac, true))
177
			return false;
178
	return true;
179
}
180

    
181
if (isset($_POST['submit'])) {
182

    
183
	unset($input_errors);
184

    
185
	$pconfig = $_POST;
186

    
187
	$numberoptions = array();
188
	for($x=0; $x<99; $x++) {
189
		if(isset($_POST["number{$x}"]) && ctype_digit($_POST["number{$x}"])) {
190
			$numbervalue = array();
191
			$numbervalue['number'] = htmlspecialchars($_POST["number{$x}"]);
192
			$numbervalue['type'] = htmlspecialchars($_POST["itemtype{$x}"]);
193
			$numbervalue['value'] = str_replace('&quot;', '"', htmlspecialchars($_POST["value{$x}"]));
194
			$numberoptions['item'][] = $numbervalue;
195
		}
196
	}
197
	// Reload the new pconfig variable that the form uses.
198
	$pconfig['numberoptions'] = $numberoptions;
199

    
200
	/* input validation */
201
	if ($_POST['enable'] || is_numeric($pool) || $act == "newpool") {
202
		$reqdfields = explode(" ", "range_from range_to");
203
		$reqdfieldsn = array(gettext("Range begin"),gettext("Range end"));
204

    
205
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
206

    
207
		if (($_POST['range_from'] && !is_ipaddrv4($_POST['range_from'])))
208
			$input_errors[] = gettext("A valid range must be specified.");
209
		if (($_POST['range_to'] && !is_ipaddrv4($_POST['range_to'])))
210
			$input_errors[] = gettext("A valid range must be specified.");
211
		if (($_POST['gateway'] && $_POST['gateway'] != "none" && !is_ipaddrv4($_POST['gateway'])))
212
			$input_errors[] = gettext("A valid IP address must be specified for the gateway.");
213
		if (($_POST['wins1'] && !is_ipaddrv4($_POST['wins1'])) || ($_POST['wins2'] && !is_ipaddrv4($_POST['wins2'])))
214
			$input_errors[] = gettext("A valid IP address must be specified for the primary/secondary WINS servers.");
215
		$parent_ip = get_interface_ip($_POST['if']);
216
		if (is_ipaddrv4($parent_ip) && $_POST['gateway'] && $_POST['gateway'] != "none") {
217
			$parent_sn = get_interface_subnet($_POST['if']);
218
			if(!ip_in_subnet($_POST['gateway'], gen_subnet($parent_ip, $parent_sn) . "/" . $parent_sn) && !ip_in_interface_alias_subnet($_POST['if'], $_POST['gateway']))
219
				$input_errors[] = sprintf(gettext("The gateway address %s does not lie within the chosen interface's subnet."), $_POST['gateway']);
220
		}
221
		if (($_POST['dns1'] && !is_ipaddrv4($_POST['dns1'])) || ($_POST['dns2'] && !is_ipaddrv4($_POST['dns2'])) || ($_POST['dns3'] && !is_ipaddrv4($_POST['dns3'])) || ($_POST['dns4'] && !is_ipaddrv4($_POST['dns4'])))
222
			$input_errors[] = gettext("A valid IP address must be specified for each of the DNS servers.");
223

    
224
		if ($_POST['deftime'] && (!is_numeric($_POST['deftime']) || ($_POST['deftime'] < 60)))
225
				$input_errors[] = gettext("The default lease time must be at least 60 seconds.");
226

    
227
		if (isset($config['captiveportal']) && is_array($config['captiveportal'])) {
228
			$deftime = 7200; // Default value if it's empty
229
			if (is_numeric($_POST['deftime']))
230
				$deftime = $_POST['deftime'];
231

    
232
			foreach ($config['captiveportal'] as $cpZone => $cpdata) {
233
				if (!isset($cpdata['enable']))
234
					continue;
235
				if (!isset($cpdata['timeout']) || !is_numeric($cpdata['timeout']))
236
					continue;
237
				$cp_ifs = explode(',', $cpdata['interface']);
238
				if (!in_array($if, $cp_ifs))
239
					continue;
240
				if ($cpdata['timeout'] > $deftime)
241
					$input_errors[] = sprintf(gettext(
242
						"The Captive Portal zone '%s' has Hard Timeout parameter set to a value bigger than Default lease time (%s)."), $cpZone, $deftime);
243
			}
244
		}
245

    
246
		if ($_POST['maxtime'] && (!is_numeric($_POST['maxtime']) || ($_POST['maxtime'] < 60) || ($_POST['maxtime'] <= $_POST['deftime'])))
247
			$input_errors[] = gettext("The maximum lease time must be at least 60 seconds and higher than the default lease time.");
248
		if (($_POST['ddnsdomain'] && !is_domain($_POST['ddnsdomain'])))
249
			$input_errors[] = gettext("A valid domain name must be specified for the dynamic DNS registration.");
250
		if (($_POST['ddnsdomain'] && !is_ipaddrv4($_POST['ddnsdomainprimary'])))
251
			$input_errors[] = gettext("A valid primary domain name server IP address must be specified for the dynamic domain name.");
252
		if (($_POST['ddnsdomainkey'] && !$_POST['ddnsdomainkeyname']) ||
253
			($_POST['ddnsdomainkeyname'] && !$_POST['ddnsdomainkey']))
254
			$input_errors[] = gettext("You must specify both a valid domain key and key name.");
255
		if ($_POST['domainsearchlist']) {
256
			$domain_array=preg_split("/[ ;]+/",$_POST['domainsearchlist']);
257
			foreach ($domain_array as $curdomain) {
258
				if (!is_domain($curdomain)) {
259
					$input_errors[] = gettext("A valid domain search list must be specified.");
260
					break;
261
				}
262
			}
263
		}
264

    
265
		// Validate MACs
266
		if (!empty($_POST['mac_allow']) && !validate_partial_mac_list($_POST['mac_allow']))
267
			$input_errors[] = gettext("If you specify a mac allow list, it must contain only valid partial MAC addresses.");
268
		if (!empty($_POST['mac_deny']) && !validate_partial_mac_list($_POST['mac_deny']))
269
			$input_errors[] = gettext("If you specify a mac deny list, it must contain only valid partial MAC addresses.");
270

    
271
		if (($_POST['ntp1'] && !is_ipaddrv4($_POST['ntp1'])) || ($_POST['ntp2'] && !is_ipaddrv4($_POST['ntp2'])))
272
			$input_errors[] = gettext("A valid IP address must be specified for the primary/secondary NTP servers.");
273
		if (($_POST['domain'] && !is_domain($_POST['domain'])))
274
			$input_errors[] = gettext("A valid domain name must be specified for the DNS domain.");
275
		if ($_POST['tftp'] && !is_ipaddrv4($_POST['tftp']) && !is_domain($_POST['tftp']) && !is_URL($_POST['tftp']))
276
			$input_errors[] = gettext("A valid IP address or hostname must be specified for the TFTP server.");
277
		if (($_POST['nextserver'] && !is_ipaddrv4($_POST['nextserver'])))
278
			$input_errors[] = gettext("A valid IP address must be specified for the network boot server.");
279

    
280
		if(gen_subnet($ifcfgip, $ifcfgsn) == $_POST['range_from'])
281
			$input_errors[] = gettext("You cannot use the network address in the starting subnet range.");
282
		if(gen_subnet_max($ifcfgip, $ifcfgsn) == $_POST['range_to'])
283
			$input_errors[] = gettext("You cannot use the broadcast address in the ending subnet range.");
284

    
285
		// Disallow a range that includes the virtualip
286
		if (is_array($config['virtualip']['vip'])) {
287
			foreach($config['virtualip']['vip'] as $vip) {
288
				if($vip['interface'] == $if)
289
					if($vip['subnet'] && is_inrange_v4($vip['subnet'], $_POST['range_from'], $_POST['range_to']))
290
						$input_errors[] = sprintf(gettext("The subnet range cannot overlap with virtual IP address %s."),$vip['subnet']);
291
			}
292
		}
293

    
294
		$noip = false;
295
		if(is_array($a_maps))
296
			foreach ($a_maps as $map)
297
				if (empty($map['ipaddr']))
298
					$noip = true;
299
		if ($_POST['staticarp'] && $noip)
300
			$input_errors[] = "Cannot enable static ARP when you have static map entries without IP addresses. Ensure all static maps have IP addresses and try again.";
301

    
302
		if(is_array($pconfig['numberoptions']['item'])) {
303
			foreach ($pconfig['numberoptions']['item'] as $numberoption) {
304
				if ( $numberoption['type'] == 'text' && strstr($numberoption['value'], '"') )
305
					$input_errors[] = gettext("Text type cannot include quotation marks.");
306
				else if ( $numberoption['type'] == 'string' && !preg_match('/^"[^"]*"$/', $numberoption['value']) && !preg_match('/^[0-9a-f]{2}(?:\:[0-9a-f]{2})*$/i', $numberoption['value']) )
307
					$input_errors[] = gettext("String type must be enclosed in quotes like \"this\" or must be a series of octets specified in hexadecimal, separated by colons, like 01:23:45:67:89:ab:cd:ef");
308
				else if ( $numberoption['type'] == 'boolean' && $numberoption['value'] != 'true' && $numberoption['value'] != 'false' && $numberoption['value'] != 'on' && $numberoption['value'] != 'off' )
309
					$input_errors[] = gettext("Boolean type must be true, false, on, or off.");
310
				else if ( $numberoption['type'] == 'unsigned integer 8' && (!is_numeric($numberoption['value']) || $numberoption['value'] < 0 || $numberoption['value'] > 255) )
311
					$input_errors[] = gettext("Unsigned 8-bit integer type must be a number in the range 0 to 255.");
312
				else if ( $numberoption['type'] == 'unsigned integer 16' && (!is_numeric($numberoption['value']) || $numberoption['value'] < 0 || $numberoption['value'] > 65535) )
313
					$input_errors[] = gettext("Unsigned 16-bit integer type must be a number in the range 0 to 65535.");
314
				else if ( $numberoption['type'] == 'unsigned integer 32' && (!is_numeric($numberoption['value']) || $numberoption['value'] < 0 || $numberoption['value'] > 4294967295) )
315
					$input_errors[] = gettext("Unsigned 32-bit integer type must be a number in the range 0 to 4294967295.");
316
				else if ( $numberoption['type'] == 'signed integer 8' && (!is_numeric($numberoption['value']) || $numberoption['value'] < -128 || $numberoption['value'] > 127) )
317
					$input_errors[] = gettext("Signed 8-bit integer type must be a number in the range -128 to 127.");
318
				else if ( $numberoption['type'] == 'signed integer 16' && (!is_numeric($numberoption['value']) || $numberoption['value'] < -32768 || $numberoption['value'] > 32767) )
319
					$input_errors[] = gettext("Signed 16-bit integer type must be a number in the range -32768 to 32767.");
320
				else if ( $numberoption['type'] == 'signed integer 32' && (!is_numeric($numberoption['value']) || $numberoption['value'] < -2147483648 || $numberoption['value'] > 2147483647) )
321
					$input_errors[] = gettext("Signed 32-bit integer type must be a number in the range -2147483648 to 2147483647.");
322
				else if ( $numberoption['type'] == 'ip-address' && !is_ipaddrv4($numberoption['value']) && !is_hostname($numberoption['value']) )
323
					$input_errors[] = gettext("IP address or host type must be an IP address or host name.");
324
			}
325
		}
326

    
327
		if (!$input_errors) {
328
			/* make sure the range lies within the current subnet */
329
			$subnet_start = ip2ulong(long2ip32(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn)));
330
			$subnet_end = ip2ulong(long2ip32(ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn))));
331

    
332
			if ((ip2ulong($_POST['range_from']) < $subnet_start) || (ip2ulong($_POST['range_from']) > $subnet_end) ||
333
			    (ip2ulong($_POST['range_to']) < $subnet_start) || (ip2ulong($_POST['range_to']) > $subnet_end)) {
334
				$input_errors[] = gettext("The specified range lies outside of the current subnet.");
335
			}
336

    
337
			if (ip2ulong($_POST['range_from']) > ip2ulong($_POST['range_to']))
338
				$input_errors[] = gettext("The range is invalid (first element higher than second element).");
339

    
340
			if (is_numeric($pool) || ($act == "newpool")) {
341
				$rfrom = $config['dhcpd'][$if]['range']['from'];
342
				$rto = $config['dhcpd'][$if]['range']['to'];
343

    
344
				if (is_inrange_v4($_POST['range_from'], $rfrom, $rto) || is_inrange_v4($_POST['range_to'], $rfrom, $rto))
345
					$input_errors[] = gettext("The specified range must not be within the DHCP range for this interface.");
346
			}
347

    
348
			foreach ($a_pools as $id => $p) {
349
				if (is_numeric($pool) && ($id == $pool))
350
					continue;
351

    
352
				if (is_inrange_v4($_POST['range_from'], $p['range']['from'], $p['range']['to']) ||
353
				    is_inrange_v4($_POST['range_to'], $p['range']['from'], $p['range']['to'])) {
354
					$input_errors[] = gettext("The specified range must not be within the range configured on a DHCP pool for this interface.");
355
					break;
356
				}
357
			}
358

    
359
			/* make sure that the DHCP Relay isn't enabled on this interface */
360
			if (isset($config['dhcrelay']['enable']) && (stristr($config['dhcrelay']['interface'], $if) !== false))
361
				$input_errors[] = sprintf(gettext("You must disable the DHCP relay on the %s interface before enabling the DHCP server."),$iflist[$if]);
362

    
363
			$dynsubnet_start = ip2ulong($_POST['range_from']);
364
			$dynsubnet_end = ip2ulong($_POST['range_to']);
365
			if (is_array($a_maps)) {
366
				foreach ($a_maps as $map) {
367
					if (empty($map['ipaddr']))
368
						continue;
369
					if ((ip2ulong($map['ipaddr']) > $dynsubnet_start) &&
370
						(ip2ulong($map['ipaddr']) < $dynsubnet_end)) {
371
						$input_errors[] = sprintf(gettext("The DHCP range cannot overlap any static DHCP mappings."));
372
						break;
373
					}
374
				}
375
			}
376
		}
377
	}
378

    
379
	if (!$input_errors) {
380
		if (!is_numeric($pool)) {
381
			if ($act == "newpool") {
382
				$dhcpdconf = array();
383
			} else {
384
				if (!is_array($config['dhcpd'][$if]))
385
					$config['dhcpd'][$if] = array();
386
				$dhcpdconf = $config['dhcpd'][$if];
387
			}
388
		} else {
389
			if (is_array($a_pools[$pool])) {
390
				$dhcpdconf = $a_pools[$pool];
391
			} else {
392
				// Someone specified a pool but it doesn't exist. Punt.
393
				header("Location: services_dhcp.php");
394
				exit;
395
			}
396
		}
397
		if (!is_array($dhcpdconf['range']))
398
			$dhcpdconf['range'] = array();
399

    
400
		$dhcpd_enable_changed = false;
401

    
402
		// Global Options
403
		if (!is_numeric($pool) && !($act == "newpool")) {
404
			$old_dhcpd_enable = isset($dhcpdconf['enable']);
405
			$new_dhcpd_enable = ($_POST['enable']) ? true : false;
406
			if ($old_dhcpd_enable != $new_dhcpd_enable) {
407
				/* DHCP has been enabled or disabled. The pf ruleset will need to be rebuilt to allow or disallow DHCP. */
408
				$dhcpd_enable_changed = true;
409
			}
410
			$dhcpdconf['enable'] = $new_dhcpd_enable;
411
			$dhcpdconf['staticarp'] = ($_POST['staticarp']) ? true : false;
412
			$previous = $dhcpdconf['failover_peerip'];
413
			if($previous <> $_POST['failover_peerip'])
414
				mwexec("/bin/rm -rf /var/dhcpd/var/db/*");
415
			$dhcpdconf['failover_peerip'] = $_POST['failover_peerip'];
416
			// dhcpleaseinlocaltime is global to all interfaces. So update the setting on all interfaces.
417
			foreach ($config['dhcpd'] as &$dhcpdifitem) {
418
				$dhcpdifitem['dhcpleaseinlocaltime'] = $_POST['dhcpleaseinlocaltime'];
419
			}
420
		} else {
421
			// Options that exist only in pools
422
			$dhcpdconf['descr'] = $_POST['descr'];
423
		}
424

    
425
		// Options that can be global or per-pool.
426
		$dhcpdconf['range']['from'] = $_POST['range_from'];
427
		$dhcpdconf['range']['to'] = $_POST['range_to'];
428
		$dhcpdconf['defaultleasetime'] = $_POST['deftime'];
429
		$dhcpdconf['maxleasetime'] = $_POST['maxtime'];
430
		$dhcpdconf['netmask'] = $_POST['netmask'];
431

    
432
		unset($dhcpdconf['winsserver']);
433
		if ($_POST['wins1'])
434
			$dhcpdconf['winsserver'][] = $_POST['wins1'];
435
		if ($_POST['wins2'])
436
			$dhcpdconf['winsserver'][] = $_POST['wins2'];
437

    
438
		unset($dhcpdconf['dnsserver']);
439
		if ($_POST['dns1'])
440
			$dhcpdconf['dnsserver'][] = $_POST['dns1'];
441
		if ($_POST['dns2'])
442
			$dhcpdconf['dnsserver'][] = $_POST['dns2'];
443
		if ($_POST['dns3'])
444
			$dhcpdconf['dnsserver'][] = $_POST['dns3'];
445
		if ($_POST['dns4'])
446
			$dhcpdconf['dnsserver'][] = $_POST['dns4'];
447

    
448
		$dhcpdconf['gateway'] = $_POST['gateway'];
449
		$dhcpdconf['domain'] = $_POST['domain'];
450
		$dhcpdconf['domainsearchlist'] = $_POST['domainsearchlist'];
451
		$dhcpdconf['denyunknown'] = ($_POST['denyunknown']) ? true : false;
452
		$dhcpdconf['ddnsdomain'] = $_POST['ddnsdomain'];
453
		$dhcpdconf['ddnsdomainprimary'] = $_POST['ddnsdomainprimary'];
454
		$dhcpdconf['ddnsdomainkeyname'] = $_POST['ddnsdomainkeyname'];
455
		$dhcpdconf['ddnsdomainkey'] = $_POST['ddnsdomainkey'];
456
		$dhcpdconf['ddnsupdate'] = ($_POST['ddnsupdate']) ? true : false;
457
		$dhcpdconf['mac_allow'] = $_POST['mac_allow'];
458
		$dhcpdconf['mac_deny'] = $_POST['mac_deny'];
459

    
460
		unset($dhcpdconf['ntpserver']);
461
		if ($_POST['ntp1'])
462
			$dhcpdconf['ntpserver'][] = $_POST['ntp1'];
463
		if ($_POST['ntp2'])
464
			$dhcpdconf['ntpserver'][] = $_POST['ntp2'];
465

    
466
		$dhcpdconf['tftp'] = $_POST['tftp'];
467
		$dhcpdconf['ldap'] = $_POST['ldap'];
468
		$dhcpdconf['netboot'] = ($_POST['netboot']) ? true : false;
469
		$dhcpdconf['nextserver'] = $_POST['nextserver'];
470
		$dhcpdconf['filename'] = $_POST['filename'];
471
		$dhcpdconf['filename32'] = $_POST['filename32'];
472
		$dhcpdconf['filename64'] = $_POST['filename64'];
473
		$dhcpdconf['rootpath'] = $_POST['rootpath'];
474

    
475
		// Handle the custom options rowhelper
476
		if(isset($dhcpdconf['numberoptions']['item']))
477
			unset($dhcpdconf['numberoptions']['item']);
478

    
479
		$dhcpdconf['numberoptions'] = $numberoptions;
480

    
481
		if (is_numeric($pool) && is_array($a_pools[$pool])) {
482
			$a_pools[$pool] = $dhcpdconf;
483
		} elseif ($act == "newpool") {
484
			$a_pools[] = $dhcpdconf;
485
		} else {
486
			$config['dhcpd'][$if] = $dhcpdconf;
487
		}
488

    
489
		write_config();
490
	}
491
}
492

    
493
if ((isset($_POST['submit']) || isset($_POST['apply'])) && (!$input_errors)) {
494
	$retval = 0;
495
	$retvaldhcp = 0;
496
	$retvaldns = 0;
497
	/* dnsmasq_configure calls dhcpd_configure */
498
	/* no need to restart dhcpd twice */
499
	if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstatic']))	{
500
		$retvaldns = services_dnsmasq_configure();
501
		if ($retvaldns == 0) {
502
			clear_subsystem_dirty('hosts');
503
			clear_subsystem_dirty('staticmaps');
504
		}
505
	} else if (isset($config['unbound']['enable']) && isset($config['unbound']['regdhcpstatic'])) {
506
		$retvaldns = services_unbound_configure();
507
		if ($retvaldns == 0) {
508
			clear_subsystem_dirty('unbound');
509
			clear_subsystem_dirty('hosts');
510
			clear_subsystem_dirty('staticmaps');
511
		}
512
	} else {
513
		$retvaldhcp = services_dhcpd_configure();
514
		if ($retvaldhcp == 0)
515
			clear_subsystem_dirty('staticmaps');
516
	}
517
	if ($dhcpd_enable_changed)
518
		$retvalfc = filter_configure();
519

    
520
	if($retvaldhcp == 1 || $retvaldns == 1 || $retvalfc == 1)
521
		$retval = 1;
522
	$savemsg = get_std_save_message($retval);
523
}
524

    
525
if ($act == "delpool") {
526
	if ($a_pools[$_GET['id']]) {
527
		unset($a_pools[$_GET['id']]);
528
		write_config();
529
		header("Location: services_dhcp.php?if={$if}");
530
		exit;
531
	}
532
}
533

    
534
if ($act == "del") {
535
	if ($a_maps[$_GET['id']]) {
536
		unset($a_maps[$_GET['id']]);
537
		write_config();
538
		if(isset($config['dhcpd'][$if]['enable'])) {
539
			mark_subsystem_dirty('staticmaps');
540
			if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstatic']))
541
				mark_subsystem_dirty('hosts');
542
		}
543
		header("Location: services_dhcp.php?if={$if}");
544
		exit;
545
	}
546
}
547

    
548
$closehead = false;
549
$pgtitle = array(gettext("Services"),gettext("DHCP server"));
550
$shortcut_section = "dhcp";
551

    
552
include("head.inc");
553

    
554
?>
555

    
556
<script type="text/javascript" src="/javascript/row_helper.js">
557
</script>
558

    
559
<script type="text/javascript">
560
//<![CDATA[
561
	function itemtype_field(fieldname, fieldsize, n) {
562
		return '<select name="' + fieldname + n + '" class="formselect" id="' + fieldname + n + '"><?php
563
			$customitemtypes = array('text' => gettext('Text'), 'string' => gettext('String'), 'boolean' => gettext('Boolean'),
564
				'unsigned integer 8' => gettext('Unsigned 8-bit integer'), 'unsigned integer 16' => gettext('Unsigned 16-bit integer'), 'unsigned integer 32' => gettext('Unsigned 32-bit integer'),
565
				'signed integer 8' => gettext('Signed 8-bit integer'), 'signed integer 16' => gettext('Signed 16-bit integer'), 'signed integer 32' => gettext('Signed 32-bit integer'), 'ip-address' => gettext('IP address or host'));
566
			foreach ($customitemtypes as $typename => $typedescr) {
567
				echo "<option value=\"{$typename}\">{$typedescr}<\/option>";
568
			}
569
		?><\/select>';
570
	}
571

    
572
	rowname[0] = "number";
573
	rowtype[0] = "textbox";
574
	rowsize[0] = "10";
575
	rowname[1] = "itemtype";
576
	rowtype[1] = itemtype_field;
577
	rowname[2] = "value";
578
	rowtype[2] = "textbox";
579
	rowsize[2] = "40";
580
//]]>
581
</script>
582

    
583
<script type="text/javascript">
584
//<![CDATA[
585
	function enable_change(enable_over) {
586
		var endis;
587
		<?php if (is_numeric($pool) || ($act == "newpool")): ?>
588
			enable_over = true;
589
		<?php endif; ?>
590
		endis = !(document.iform.enable.checked || enable_over);
591
		<?php if (is_numeric($pool) || ($act == "newpool")): ?>
592
			document.iform.descr.disabled = endis;
593
		<?php endif; ?>
594
		document.iform.range_from.disabled = endis;
595
		document.iform.range_to.disabled = endis;
596
		document.iform.wins1.disabled = endis;
597
		document.iform.wins2.disabled = endis;
598
		document.iform.dns1.disabled = endis;
599
		document.iform.dns2.disabled = endis;
600
		document.iform.dns3.disabled = endis;
601
		document.iform.dns4.disabled = endis;
602
		document.iform.deftime.disabled = endis;
603
		document.iform.maxtime.disabled = endis;
604
		document.iform.gateway.disabled = endis;
605
		document.iform.failover_peerip.disabled = endis;
606
		document.iform.domain.disabled = endis;
607
		document.iform.domainsearchlist.disabled = endis;
608
		document.iform.staticarp.disabled = endis;
609
		document.iform.dhcpleaseinlocaltime.disabled = endis;
610
		document.iform.ddnsdomain.disabled = endis;
611
		document.iform.ddnsdomainprimary.disabled = endis;
612
		document.iform.ddnsdomainkeyname.disabled = endis;
613
		document.iform.ddnsdomainkey.disabled = endis;
614
		document.iform.ddnsupdate.disabled = endis;
615
		document.iform.mac_allow.disabled = endis;
616
		document.iform.mac_deny.disabled = endis;
617
		document.iform.ntp1.disabled = endis;
618
		document.iform.ntp2.disabled = endis;
619
		document.iform.tftp.disabled = endis;
620
		document.iform.ldap.disabled = endis;
621
		document.iform.netboot.disabled = endis;
622
		document.iform.nextserver.disabled = endis;
623
		document.iform.filename.disabled = endis;
624
		document.iform.filename32.disabled = endis;
625
		document.iform.filename64.disabled = endis;
626
		document.iform.rootpath.disabled = endis;
627
		document.iform.denyunknown.disabled = endis;
628
	}
629

    
630
	function show_shownumbervalue() {
631
		document.getElementById("shownumbervaluebox").innerHTML='';
632
		aodiv = document.getElementById('shownumbervalue');
633
		aodiv.style.display = "block";
634
	}
635

    
636
	function show_ddns_config() {
637
		document.getElementById("showddnsbox").innerHTML='';
638
		aodiv = document.getElementById('showddns');
639
		aodiv.style.display = "block";
640
	}
641

    
642
	function show_maccontrol_config() {
643
		document.getElementById("showmaccontrolbox").innerHTML='';
644
		aodiv = document.getElementById('showmaccontrol');
645
		aodiv.style.display = "block";
646
	}
647

    
648
	function show_ntp_config() {
649
		document.getElementById("showntpbox").innerHTML='';
650
		aodiv = document.getElementById('showntp');
651
		aodiv.style.display = "block";
652
	}
653

    
654
	function show_tftp_config() {
655
		document.getElementById("showtftpbox").innerHTML='';
656
		aodiv = document.getElementById('showtftp');
657
		aodiv.style.display = "block";
658
	}
659

    
660
	function show_ldap_config() {
661
		document.getElementById("showldapbox").innerHTML='';
662
		aodiv = document.getElementById('showldap');
663
		aodiv.style.display = "block";
664
	}
665

    
666
	function show_netboot_config() {
667
		document.getElementById("shownetbootbox").innerHTML='';
668
		aodiv = document.getElementById('shownetboot');
669
		aodiv.style.display = "block";
670
	}
671
//]]>
672
</script>
673
</head>
674

    
675
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
676
<?php include("fbegin.inc"); ?>
677
<form action="services_dhcp.php" method="post" name="iform" id="iform">
678
<?php if ($input_errors) print_input_errors($input_errors); ?>
679
<?php if ($savemsg) print_info_box($savemsg); ?>
680
<?php
681
	if (isset($config['dhcrelay']['enable'])) {
682
		echo gettext("DHCP Relay is currently enabled. Cannot enable the DHCP Server service while the DHCP Relay is enabled on any interface.");
683
		include("fend.inc");
684
		echo "</body>";
685
		echo "</html>";
686
		exit;
687
	}
688
?>
689
<?php if (is_subsystem_dirty('staticmaps')): ?><br/>
690
<?php print_info_box_np(gettext("The static mapping configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?><br />
691
<?php endif; ?>
692
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="dhcp server">
693
<tr><td>
694
<?php
695
	/* active tabs */
696
	$tab_array = array();
697
	$tabscounter = 0;
698
	$i = 0;
699
	foreach ($iflist as $ifent => $ifname) {
700
		$oc = $config['interfaces'][$ifent];
701
		if ((is_array($config['dhcpd'][$ifent]) && !isset($config['dhcpd'][$ifent]['enable']) && (!is_ipaddrv4($oc['ipaddr']))) ||
702
			(!is_array($config['dhcpd'][$ifent]) && (!is_ipaddrv4($oc['ipaddr']))))
703
			continue;
704
		if ($ifent == $if)
705
			$active = true;
706
		else
707
			$active = false;
708
		$tab_array[] = array($ifname, $active, "services_dhcp.php?if={$ifent}");
709
		$tabscounter++;
710
	}
711
	if ($tabscounter == 0) {
712
		echo "<b>" . gettext("The DHCP Server can only be enabled on interfaces configured with a static IPv4 address. This system has none.") . "<br/><br/>";
713
		echo "</td></tr></table></form>";
714
		include("fend.inc");
715
		echo "</body>";
716
		echo "</html>";
717
		exit;
718
	}
719
	display_top_tabs($tab_array);
720
?>
721
</td></tr>
722
<tr>
723
<td>
724
	<div id="mainarea">
725
		<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
726
			<?php if (!is_numeric($pool) && !($act == "newpool")): ?>
727
			<tr>
728
			<td width="22%" valign="top" class="vtable">&nbsp;</td>
729
			<td width="78%" class="vtable">
730
				<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onclick="enable_change(false)" />
731
			<strong><?php printf(gettext("Enable DHCP server on " .
732
			"%s " .
733
			"interface"),htmlspecialchars($iflist[$if]));?></strong></td>
734
			</tr>
735
			<?php else: ?>
736
			<tr>
737
				<td colspan="2" class="listtopic"><?php echo gettext("Editing Pool-Specific Options. To return to the Interface, click its tab above."); ?></td>
738
			</tr>
739
			<?php endif; ?>
740
			<tr>
741
			<td width="22%" valign="top" class="vtable">&nbsp;</td>
742
			<td width="78%" class="vtable">
743
				<input name="denyunknown" id="denyunknown" type="checkbox" value="yes" <?php if ($pconfig['denyunknown']) echo "checked=\"checked\""; ?> />
744
				<strong><?=gettext("Deny unknown clients");?></strong><br />
745
				<?=gettext("If this is checked, only the clients defined below will get DHCP leases from this server. ");?></td>
746
			</tr>
747
			<?php if (is_numeric($pool) || ($act == "newpool")): ?>
748
				<tr>
749
				<td width="22%" valign="top" class="vncell"><?=gettext("Pool Description");?></td>
750
				<td width="78%" class="vtable">
751
					<input name="descr" type="text" class="formfld unknown" id="descr" size="20" value="<?=htmlspecialchars($pconfig['descr']);?>" />
752
				</td>
753
				</tr>
754
			<?php endif; ?>
755
			<tr>
756
			<td width="22%" valign="top" class="vncellreq"><?=gettext("Subnet");?></td>
757
			<td width="78%" class="vtable">
758
				<?=gen_subnet($ifcfgip, $ifcfgsn);?>
759
			</td>
760
			</tr>
761
			<tr>
762
			<td width="22%" valign="top" class="vncellreq"><?=gettext("Subnet mask");?></td>
763
			<td width="78%" class="vtable">
764
				<?=gen_subnet_mask($ifcfgsn);?>
765
			</td>
766
			</tr>
767
			<tr>
768
			<td width="22%" valign="top" class="vncellreq"><?=gettext("Available range");?></td>
769
			<td width="78%" class="vtable">
770
			<?php
771
				$range_from = ip2long(long2ip32(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn)));
772
				$range_from++;
773
				echo long2ip32($range_from);
774
			?>
775
			-
776
			<?php
777
				$range_to = ip2long(long2ip32(ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn))));
778
				$range_to--;
779
				echo long2ip32($range_to);
780
			?>
781
			<?php if (is_numeric($pool) || ($act == "newpool")): ?>
782
				<br />In-use DHCP Pool Ranges:
783
				<?php if (is_array($config['dhcpd'][$if]['range'])): ?>
784
					<br /><?php echo $config['dhcpd'][$if]['range']['from']; ?>-<?php echo $config['dhcpd'][$if]['range']['to']; ?>
785
				<?php endif; ?>
786
				<?php foreach ($a_pools as $p): ?>
787
					<?php if (is_array($p['range'])): ?>
788
					<br /><?php echo $p['range']['from']; ?>-<?php echo $p['range']['to']; ?>
789
					<?php endif; ?>
790
				<?php endforeach; ?>
791
			<?php endif; ?>
792
			</td>
793
			</tr>
794
			<?php if($is_olsr_enabled): ?>
795
			<tr>
796
			<td width="22%" valign="top" class="vncellreq"><?=gettext("Subnet Mask");?></td>
797
			<td width="78%" class="vtable">
798
				<select name="netmask" class="formselect" id="netmask">
799
				<?php
800
				for ($i = 32; $i > 0; $i--) {
801
					if($i <> 31) {
802
						echo "<option value=\"{$i}\" ";
803
						if ($i == $pconfig['netmask']) echo "selected=\"selected\"";
804
						echo ">" . $i . "</option>";
805
					}
806
				}
807
				?>
808
				</select>
809
			</td>
810
			</tr>
811
			<?php endif; ?>
812
			<tr>
813
			<td width="22%" valign="top" class="vncellreq"><?=gettext("Range");?></td>
814
			<td width="78%" class="vtable">
815
				<input name="range_from" type="text" class="formfld unknown" id="range_from" size="20" value="<?=htmlspecialchars($pconfig['range_from']);?>" />
816
				&nbsp;<?=gettext("to"); ?>&nbsp; <input name="range_to" type="text" class="formfld unknown" id="range_to" size="20" value="<?=htmlspecialchars($pconfig['range_to']);?>" />
817
			</td>
818
			</tr>
819
			<?php if (!is_numeric($pool) && !($act == "newpool")): ?>
820
			<tr>
821
			<td width="22%" valign="top" class="vncell"><?=gettext("Additional Pools");?></td>
822
			<td width="78%" class="vtable">
823
				<?php echo gettext("If you need additional pools of addresses inside of this subnet outside the above Range, they may be specified here."); ?>
824
				<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="subnet">
825
				<tr>
826
					<td width="35%" class="listhdrr"><?=gettext("Pool Start");?></td>
827
					<td width="35%" class="listhdrr"><?=gettext("Pool End");?></td>
828
					<td width="20%" class="listhdrr"><?=gettext("Description");?></td>
829
					<td width="10%" class="list">
830
					<table border="0" cellspacing="0" cellpadding="1" summary="pool">
831
					<tr>
832
					<td valign="middle" width="17"></td>
833
					<td valign="middle"><a href="services_dhcp.php?if=<?=htmlspecialchars($if);?>&amp;act=newpool"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="plus" /></a></td>
834
					</tr>
835
					</table>
836
					</td>
837
				</tr>
838
					<?php if(is_array($a_pools)): ?>
839
					<?php $i = 0; foreach ($a_pools as $poolent): ?>
840
					<?php if(!empty($poolent['range']['from']) && !empty($poolent['range']['to'])): ?>
841
				<tr>
842
				<td class="listlr" ondblclick="document.location='services_dhcp.php?if=<?=htmlspecialchars($if);?>&amp;pool=<?=$i;?>';">
843
					<?=htmlspecialchars($poolent['range']['from']);?>
844
				</td>
845
				<td class="listr" ondblclick="document.location='services_dhcp.php?if=<?=htmlspecialchars($if);?>&amp;pool=<?=$i;?>';">
846
					<?=htmlspecialchars($poolent['range']['to']);?>&nbsp;
847
				</td>
848
				<td class="listr" ondblclick="document.location='services_dhcp.php?if=<?=htmlspecialchars($if);?>&amp;pool=<?=$i;?>';">
849
					<?=htmlspecialchars($poolent['descr']);?>&nbsp;
850
				</td>
851
				<td valign="middle" class="list nowrap">
852
					<table border="0" cellspacing="0" cellpadding="1" summary="icons">
853
					<tr>
854
					<td valign="middle"><a href="services_dhcp.php?if=<?=htmlspecialchars($if);?>&amp;pool=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="edit" /></a></td>
855
					<td valign="middle"><a href="services_dhcp.php?if=<?=htmlspecialchars($if);?>&amp;act=delpool&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this pool?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="delete" /></a></td>
856
					</tr>
857
					</table>
858
				</td>
859
				</tr>
860
				<?php endif; ?>
861
				<?php $i++; endforeach; ?>
862
				<?php endif; ?>
863
				<tr>
864
				<td class="list" colspan="3"></td>
865
				<td class="list">
866
					<table border="0" cellspacing="0" cellpadding="1" summary="add">
867
					<tr>
868
					<td valign="middle" width="17"></td>
869
					<td valign="middle"><a href="services_dhcp.php?if=<?=htmlspecialchars($if);?>&amp;act=newpool"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="add" /></a></td>
870
					</tr>
871
					</table>
872
				</td>
873
				</tr>
874
				</table>
875
			</td>
876
			</tr>
877
			<?php endif; ?>
878
			<tr>
879
			<td width="22%" valign="top" class="vncell"><?=gettext("WINS servers");?></td>
880
			<td width="78%" class="vtable">
881
				<input name="wins1" type="text" class="formfld unknown" id="wins1" size="20" value="<?=htmlspecialchars($pconfig['wins1']);?>" /><br />
882
				<input name="wins2" type="text" class="formfld unknown" id="wins2" size="20" value="<?=htmlspecialchars($pconfig['wins2']);?>" />
883
			</td>
884
			</tr>
885
			<tr>
886
			<td width="22%" valign="top" class="vncell"><?=gettext("DNS servers");?></td>
887
			<td width="78%" class="vtable">
888
				<input name="dns1" type="text" class="formfld unknown" id="dns1" size="20" value="<?=htmlspecialchars($pconfig['dns1']);?>" /><br />
889
				<input name="dns2" type="text" class="formfld unknown" id="dns2" size="20" value="<?=htmlspecialchars($pconfig['dns2']);?>" /><br />
890
				<input name="dns3" type="text" class="formfld unknown" id="dns3" size="20" value="<?=htmlspecialchars($pconfig['dns3']);?>" /><br />
891
				<input name="dns4" type="text" class="formfld unknown" id="dns4" size="20" value="<?=htmlspecialchars($pconfig['dns4']);?>" /><br />
892
				<?=gettext("NOTE: leave blank to use the system default DNS servers - this interface's IP if DNS Forwarder or Resolver is enabled, otherwise the servers configured on the General page.");?>
893
			</td>
894
			</tr>
895
			<tr>
896
			<td width="22%" valign="top" class="vncell"><?=gettext("Gateway");?></td>
897
			<td width="78%" class="vtable">
898
				<input name="gateway" type="text" class="formfld host" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>" /><br />
899
				<?=gettext("The default is to use the IP on this interface of the firewall as the gateway. Specify an alternate gateway here if this is not the correct gateway for your network. Type \"none\" for no gateway assignment.");?>
900
			</td>
901
			</tr>
902
			<tr>
903
			<td width="22%" valign="top" class="vncell"><?=gettext("Domain name");?></td>
904
			<td width="78%" class="vtable">
905
				<input name="domain" type="text" class="formfld unknown" id="domain" size="20" value="<?=htmlspecialchars($pconfig['domain']);?>" /><br />
906
				<?=gettext("The default is to use the domain name of this system as the default domain name provided by DHCP. You may specify an alternate domain name here.");?>
907
			</td>
908
			</tr>
909
			<tr>
910
			<td width="22%" valign="top" class="vncell"><?=gettext("Domain search list");?></td>
911
			<td width="78%" class="vtable">
912
				<input name="domainsearchlist" type="text" class="formfld unknown" id="domainsearchlist" size="20" value="<?=htmlspecialchars($pconfig['domainsearchlist']);?>" /><br />
913
				<?=gettext("The DHCP server can optionally provide a domain search list. Use the semicolon character as separator ");?>
914
			</td>
915
			</tr>
916
			<tr>
917
			<td width="22%" valign="top" class="vncell"><?=gettext("Default lease time");?></td>
918
			<td width="78%" class="vtable">
919
				<input name="deftime" type="text" class="formfld unknown" id="deftime" size="10" value="<?=htmlspecialchars($pconfig['deftime']);?>" />
920
				<?=gettext("seconds");?><br />
921
				<?=gettext("This is used for clients that do not ask for a specific " .
922
				"expiration time."); ?><br />
923
				<?=gettext("The default is 7200 seconds.");?>
924
			</td>
925
			</tr>
926
			<tr>
927
			<td width="22%" valign="top" class="vncell"><?=gettext("Maximum lease time");?></td>
928
			<td width="78%" class="vtable">
929
				<input name="maxtime" type="text" class="formfld unknown" id="maxtime" size="10" value="<?=htmlspecialchars($pconfig['maxtime']);?>" />
930
				<?=gettext("seconds");?><br />
931
				<?=gettext("This is the maximum lease time for clients that ask".
932
				" for a specific expiration time."); ?><br />
933
				<?=gettext("The default is 86400 seconds.");?>
934
			</td>
935
			</tr>
936
			<?php if (!is_numeric($pool) && !($act == "newpool")): ?>
937
			<tr>
938
			<td width="22%" valign="top" class="vncell"><?=gettext("Failover peer IP:");?></td>
939
			<td width="78%" class="vtable">
940
				<input name="failover_peerip" type="text" class="formfld host" id="failover_peerip" size="20" value="<?=htmlspecialchars($pconfig['failover_peerip']);?>" /><br />
941
				<?=gettext("Leave blank to disable.  Enter the interface IP address of the other machine.  Machines must be using CARP. Interface's advskew determines whether the DHCPd process is Primary or Secondary. Ensure one machine's advskew<20 (and the other is >20).");?>
942
			</td>
943
			</tr>
944
			<?php endif; ?>
945
			<?php if (!is_numeric($pool) && !($act == "newpool")): ?>
946
			<tr>
947
			<td width="22%" valign="top" class="vncell"><?=gettext("Static ARP");?></td>
948
			<td width="78%" class="vtable">
949
				<table summary="static arp">
950
					<tr>
951
					<td>
952
						<input style="vertical-align:middle" type="checkbox" value="yes" name="staticarp" id="staticarp" <?php if($pconfig['staticarp']) echo " checked=\"checked\""; ?> />&nbsp;
953
					</td>
954
					<td><b><?=gettext("Enable Static ARP entries");?></b></td>
955
					</tr>
956
					<tr>
957
					<td>&nbsp;</td>
958
					<td>
959
						<span class="red"><strong><?=gettext("Note:");?></strong></span> <?=gettext("This option persists even if DHCP server is disabled. Only the machines listed below will be able to communicate with the firewall on this NIC.");?>
960
					</td>
961
					</tr>
962
				</table>
963
			</td>
964
			</tr>
965
			<?php endif; ?>
966
			<?php if (!is_numeric($pool) && !($act == "newpool")): ?>
967
			<tr>
968
				<td width="22%" valign="top" class="vncell"><?=gettext("Time format change"); ?></td>
969
				<td width="78%" class="vtable">
970
				<table summary="time format">
971
					<tr>
972
					<td>
973
						<input name="dhcpleaseinlocaltime" type="checkbox" id="dhcpleaseinlocaltime" value="yes" <?php if ($pconfig['dhcpleaseinlocaltime']) echo "checked=\"checked\""; ?> />
974
					</td>
975
					<td>
976
						<strong>
977
							<?=gettext("Change DHCP display lease time from UTC to local time."); ?>
978
						</strong>
979
					</td>
980
					</tr>
981
					<tr>
982
					<td>&nbsp;</td>
983
					<td>
984
						<span class="red"><strong><?=gettext("Note:");?></strong></span> <?=gettext("By default DHCP leases are displayed in UTC time.  By checking this
985
						box DHCP lease time will be displayed in local time and set to time zone selected.  This will be used for all DHCP interfaces lease time."); ?>
986
					</td>
987
					</tr>
988
				</table>
989
				</td>
990
			</tr>
991
			<?php endif; ?>
992
			<tr>
993
			<td width="22%" valign="top" class="vncell"><?=gettext("Dynamic DNS");?></td>
994
			<td width="78%" class="vtable">
995
				<div id="showddnsbox">
996
					<input type="button" onclick="show_ddns_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Dynamic DNS");?>
997
				</div>
998
				<div id="showddns" style="display:none">
999
					<input style="vertical-align:middle" type="checkbox" value="yes" name="ddnsupdate" id="ddnsupdate" <?php if($pconfig['ddnsupdate']) echo " checked=\"checked\""; ?> />&nbsp;
1000
					<b><?=gettext("Enable registration of DHCP client names in DNS.");?></b><br />
1001
					<br/>
1002
					<input name="ddnsdomain" type="text" class="formfld unknown" id="ddnsdomain" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomain']);?>" /><br />
1003
					<?=gettext("Note: Leave blank to disable dynamic DNS registration.");?><br />
1004
					<?=gettext("Enter the dynamic DNS domain which will be used to register client names in the DNS server.");?><br />
1005
					<input name="ddnsdomainprimary" type="text" class="formfld unknown" id="ddnsdomainprimary" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomainprimary']);?>" /><br />
1006
					<?=gettext("Enter the primary domain name server IP address for the dynamic domain name.");?><br />
1007
					<input name="ddnsdomainkeyname" type="text" class="formfld unknown" id="ddnsdomainkeyname" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomainkeyname']);?>" /><br />
1008
					<?=gettext("Enter the dynamic DNS domain key name which will be used to register client names in the DNS server.");?><br />
1009
					<input name="ddnsdomainkey" type="text" class="formfld unknown" id="ddnsdomainkey" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomainkey']);?>" /><br />
1010
					<?=gettext("Enter the dynamic DNS domain key secret which will be used to register client names in the DNS server.");?>
1011
				</div>
1012
			</td>
1013
			</tr>
1014
			<tr>
1015
			<td width="22%" valign="top" class="vncell"><?=gettext("MAC Address Control");?></td>
1016
			<td width="78%" class="vtable">
1017
				<div id="showmaccontrolbox">
1018
					<input type="button" onclick="show_maccontrol_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show MAC Address Control");?>
1019
				</div>
1020
				<div id="showmaccontrol" style="display:none">
1021
					<input name="mac_allow" type="text" class="formfld unknown" id="mac_allow" size="20" value="<?=htmlspecialchars($pconfig['mac_allow']);?>" /><br />
1022
					<?=gettext("Enter a list of partial MAC addresses to allow, comma separated, no spaces, such as ");?>00:00:00,01:E5:FF<br />
1023
					<input name="mac_deny" type="text" class="formfld unknown" id="mac_deny" size="20" value="<?=htmlspecialchars($pconfig['mac_deny']);?>" /><br />
1024
					<?=gettext("Enter a list of partial MAC addresses to deny access, comma separated, no spaces, such as ");?>00:00:00,01:E5:FF
1025
				</div>
1026
			</td>
1027
			</tr>
1028
			<tr>
1029
			<td width="22%" valign="top" class="vncell"><?=gettext("NTP servers");?></td>
1030
			<td width="78%" class="vtable">
1031
				<div id="showntpbox">
1032
					<input type="button" onclick="show_ntp_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show NTP configuration");?>
1033
				</div>
1034
				<div id="showntp" style="display:none">
1035
					<input name="ntp1" type="text" class="formfld unknown" id="ntp1" size="20" value="<?=htmlspecialchars($pconfig['ntp1']);?>" /><br />
1036
					<input name="ntp2" type="text" class="formfld unknown" id="ntp2" size="20" value="<?=htmlspecialchars($pconfig['ntp2']);?>" />
1037
				</div>
1038
			</td>
1039
			</tr>
1040
			<tr>
1041
			<td width="22%" valign="top" class="vncell"><?=gettext("TFTP server");?></td>
1042
			<td width="78%" class="vtable">
1043
			<div id="showtftpbox">
1044
				<input type="button" onclick="show_tftp_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show TFTP configuration");?>
1045
			</div>
1046
			<div id="showtftp" style="display:none">
1047
				<input name="tftp" type="text" class="formfld unknown" id="tftp" size="50" value="<?=htmlspecialchars($pconfig['tftp']);?>" /><br />
1048
				<?=gettext("Leave blank to disable.  Enter a full hostname or IP for the TFTP server.");?>
1049
			</div>
1050
			</td>
1051
			</tr>
1052
			<tr>
1053
			<td width="22%" valign="top" class="vncell"><?=gettext("LDAP URI");?></td>
1054
			<td width="78%" class="vtable">
1055
				<div id="showldapbox">
1056
					<input type="button" onclick="show_ldap_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show LDAP configuration");?>
1057
				</div>
1058
				<div id="showldap" style="display:none">
1059
					<input name="ldap" type="text" class="formfld unknown" id="ldap" size="80" value="<?=htmlspecialchars($pconfig['ldap']);?>" /><br />
1060
					<?=gettext("Leave blank to disable.  Enter a full URI for the LDAP server in the form ldap://ldap.example.com/dc=example,dc=com");?>
1061
				</div>
1062
			</td>
1063
			</tr>
1064
			<tr>
1065
			<td width="22%" valign="top" class="vncell"><?=gettext("Enable network booting");?></td>
1066
			<td width="78%" class="vtable">
1067
				<div id="shownetbootbox">
1068
					<input type="button" onclick="show_netboot_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Network booting");?>
1069
				</div>
1070
				<div id="shownetboot" style="display:none">
1071
					<input style="vertical-align:middle" type="checkbox" value="yes" name="netboot" id="netboot" <?php if($pconfig['netboot']) echo " checked=\"checked\""; ?> />&nbsp;
1072
					<b><?=gettext("Enables network booting.");?></b>
1073
					<br/>
1074
					<table border="0" cellspacing="0" cellpadding="2" summary="network booting">
1075
						<tr>
1076
							<td>
1077
								<?=gettext("Enter the IP of the"); ?> <b><?=gettext("next-server"); ?></b>
1078
							</td>
1079
							<td>
1080
								<input name="nextserver" type="text" class="formfld unknown" id="nextserver" size="20" value="<?=htmlspecialchars($pconfig['nextserver']);?>" /><br />
1081
							</td>
1082
						</tr>
1083
						<tr>
1084
							<td>
1085
								<?=gettext("and the default bios filename");?>
1086
							</td>
1087
							<td>
1088
								<input name="filename" type="text" class="formfld unknown" id="filename" size="20" value="<?=htmlspecialchars($pconfig['filename']);?>" /><br />
1089
							</td>
1090
						</tr>
1091
						<tr>
1092
							<td>
1093
								<?=gettext("and the UEFI 32bit filename  ");?>
1094
							</td>
1095
							<td>
1096
								<input name="filename32" type="text" class="formfld unknown" id="filename32" size="20" value="<?=htmlspecialchars($pconfig['filename32']);?>" /><br />
1097
							</td>
1098
						</tr>
1099
						<tr>
1100
							<td>
1101
								<?=gettext("and the UEFI 64bit filename  ");?>
1102
							</td>
1103
							<td>
1104
								<input name="filename64" type="text" class="formfld unknown" id="filename64" size="20" value="<?=htmlspecialchars($pconfig['filename64']);?>" /><br />
1105
							</td>
1106
						</tr>
1107
					</table>
1108
					<?=gettext("Note: You need both a filename and a boot server configured for this to work!");?>
1109
					<?=gettext("You will need all three filenames and a boot server configured for UEFI to work!");?>
1110
					<?=gettext("Enter the"); ?> <b><?=gettext("root-path"); ?></b>-<?=gettext("string");?>
1111
					<input name="rootpath" type="text" class="formfld unknown" id="rootpath" size="90" value="<?=htmlspecialchars($pconfig['rootpath']);?>" /><br />
1112
					<?=gettext("Note: string-format: iscsi:(servername):(protocol):(port):(LUN):targetname");?>
1113
				</div>
1114
			</td>
1115
			</tr>
1116
			<?php if (!is_numeric($pool) && !($act == "newpool")): ?>
1117
			<tr>
1118
			<td width="22%" valign="top" class="vncell"><?=gettext("Additional BOOTP/DHCP Options");?></td>
1119
			<td width="78%" class="vtable">
1120
				<div id="shownumbervaluebox">
1121
					<input type="button" onclick="show_shownumbervalue()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Additional BOOTP/DHCP Options");?>
1122
				</div>
1123
				<div id="shownumbervalue" style="display:none">
1124
				<table id="maintable" summary="bootp-dhcp options">
1125
				<tbody>
1126
				<tr>
1127
				<td colspan="3">
1128
					<div style="padding:5px; margin-top: 16px; margin-bottom: 16px; border:1px dashed #000066; background-color: #ffffff; color: #000000; font-size: 8pt;" id="itemhelp">
1129
					<?=gettext("Enter the DHCP option number and the value for each item you would like to include in the DHCP lease information.  For a list of available options please visit this"); ?> <a href="http://www.iana.org/assignments/bootp-dhcp-parameters/" target="_blank"><?=gettext("URL"); ?></a>
1130
					</div>
1131
				</td>
1132
				</tr>
1133
				<tr>
1134
				<td><div id="onecolumn"><?=gettext("Number");?></div></td>
1135
				<td><div id="twocolumn"><?=gettext("Type");?></div></td>
1136
				<td><div id="threecolumn"><?=gettext("Value");?></div></td>
1137
				</tr>
1138
				<?php $counter = 0; ?>
1139
				<?php
1140
					if($pconfig['numberoptions'])
1141
						foreach($pconfig['numberoptions']['item'] as $item):
1142
				?>
1143
					<?php
1144
						$number = $item['number'];
1145
						$itemtype = $item['type'];
1146
						$value = $item['value'];
1147
					?>
1148
				<tr>
1149
				<td>
1150
					<input autocomplete="off" name="number<?php echo $counter; ?>" type="text" class="formfld unknown" id="number<?php echo $counter; ?>" size="10" value="<?=htmlspecialchars($number);?>" />
1151
				</td>
1152
				<td>
1153
					<select name="itemtype<?php echo $counter; ?>" class="formselect" id="itemtype<?php echo $counter; ?>">
1154
					<?php
1155
					foreach ($customitemtypes as $typename => $typedescr) {
1156
						echo "<option value=\"{$typename}\" ";
1157
						if ($itemtype == $typename) echo "selected=\"selected\"";
1158
						echo ">" . $typedescr . "</option>";
1159
					}
1160
					?>
1161
					</select>
1162
				</td>
1163
				<td>
1164
					<input autocomplete="off" name="value<?php echo $counter; ?>" type="text" class="formfld unknown" id="value<?php echo $counter; ?>" size="40" value="<?=htmlspecialchars($value);?>" />
1165
				</td>
1166
				<td>
1167
					<a onclick="removeRow(this); return false;" href="#"><img border="0" src="/themes/<?echo $g['theme'];?>/images/icons/icon_x.gif" alt="delete" /></a>
1168
				</td>
1169
				</tr>
1170
				<?php $counter++; ?>
1171
				<?php endforeach; ?>
1172
				</tbody>
1173
				</table>
1174
				<a onclick="javascript:addRowTo('maintable', 'formfldalias'); return false;" href="#">
1175
					<img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="" title="<?=gettext("add another entry");?>" />
1176
				</a>
1177
				<script type="text/javascript">
1178
				//<![CDATA[
1179
					field_counter_js = 3;
1180
					rows = 1;
1181
					totalrows = <?php echo $counter; ?>;
1182
					loaded = <?php echo $counter; ?>;
1183
				//]]>
1184
				</script>
1185
				</div>
1186

    
1187
				</td>
1188
			</tr>
1189
			<?php endif; ?>
1190
			<tr>
1191
			<td width="22%" valign="top">&nbsp;</td>
1192
			<td width="78%">
1193
				<?php if ($act == "newpool"): ?>
1194
				<input type="hidden" name="act" value="newpool" />
1195
				<?php endif; ?>
1196
				<?php if (is_numeric($pool)): ?>
1197
				<input type="hidden" name="pool" value="<?php echo $pool; ?>" />
1198
				<?php endif; ?>
1199
				<input name="if" type="hidden" value="<?=htmlspecialchars($if);?>" />
1200
				<input name="submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onclick="enable_change(true)" />
1201
			</td>
1202
			</tr>
1203
			<tr>
1204
			<td width="22%" valign="top">&nbsp;</td>
1205
			<td width="78%"> <p><span class="vexpl"><span class="red"><strong><?=gettext("Note:");?><br />
1206
				</strong></span><?=gettext("The DNS servers entered in"); ?> <a href="system.php"><?=gettext("System: " .
1207
				"General setup"); ?></a> <?=gettext("(or the"); ?> <a href="services_dnsmasq.php"><?=gettext("DNS " .
1208
				"forwarder"); ?></a>, <?=gettext("if enabled)"); ?> </span><span class="vexpl"><?=gettext("will " .
1209
				"be assigned to clients by the DHCP server."); ?><br />
1210
				<br />
1211
				<?=gettext("The DHCP lease table can be viewed on the"); ?> <a href="status_dhcp_leases.php"><?=gettext("Status: " .
1212
				"DHCP leases"); ?></a> <?=gettext("page."); ?><br />
1213
				</span></p>
1214
			</td>
1215
			</tr>
1216
		</table>
1217
		<?php if (!is_numeric($pool) && !($act == "newpool")): ?>
1218
		<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="static mappings">
1219
		<tr>
1220
			<td colspan="5" valign="top" class="listtopic"><?=gettext("DHCP Static Mappings for this interface.");?></td>
1221
			<td>&nbsp;</td>
1222
		</tr>
1223
		<tr>
1224
			<td width="7%" class="listhdrr"><?=gettext("Static ARP");?></td>
1225
			<td width="18%" class="listhdrr"><?=gettext("MAC address");?></td>
1226
			<td width="15%" class="listhdrr"><?=gettext("IP address");?></td>
1227
			<td width="20%" class="listhdrr"><?=gettext("Hostname");?></td>
1228
			<td width="30%" class="listhdr"><?=gettext("Description");?></td>
1229
			<td width="10%" class="list">
1230
			<table border="0" cellspacing="0" cellpadding="1" summary="add">
1231
			<tr>
1232
			<td valign="middle" width="17"></td>
1233
			<td valign="middle"><a href="services_dhcp_edit.php?if=<?=htmlspecialchars($if);?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="add" /></a></td>
1234
			</tr>
1235
			</table>
1236
			</td>
1237
		</tr>
1238
			<?php if(is_array($a_maps)): ?>
1239
			<?php $i = 0; foreach ($a_maps as $mapent): ?>
1240
		<tr>
1241
		<td align="center" class="listlr" ondblclick="document.location='services_dhcp_edit.php?if=<?=htmlspecialchars($if);?>&amp;id=<?=$i;?>';">
1242
			<?php if (isset($mapent['arp_table_static_entry'])): ?>
1243
				<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_alert.gif" alt="ARP Table Static Entry" width="17" height="17" border="0" alt="alert" />
1244
			<?php endif; ?>
1245
		</td>
1246
		<td class="listlr" ondblclick="document.location='services_dhcp_edit.php?if=<?=htmlspecialchars($if);?>&amp;id=<?=$i;?>';">
1247
			<?=htmlspecialchars($mapent['mac']);?>
1248
		</td>
1249
		<td class="listr" ondblclick="document.location='services_dhcp_edit.php?if=<?=htmlspecialchars($if);?>&amp;id=<?=$i;?>';">
1250
			<?=htmlspecialchars($mapent['ipaddr']);?>&nbsp;
1251
		</td>
1252
		<td class="listr" ondblclick="document.location='services_dhcp_edit.php?if=<?=htmlspecialchars($if);?>&amp;id=<?=$i;?>';">
1253
			<?=htmlspecialchars($mapent['hostname']);?>&nbsp;
1254
		</td>
1255
		<td class="listbg" ondblclick="document.location='services_dhcp_edit.php?if=<?=htmlspecialchars($if);?>&amp;id=<?=$i;?>';">
1256
			<?=htmlspecialchars($mapent['descr']);?>&nbsp;
1257
		</td>
1258
		<td valign="middle" class="list nowrap">
1259
			<table border="0" cellspacing="0" cellpadding="1" summary="icons">
1260
			<tr>
1261
			<td valign="middle"><a href="services_dhcp_edit.php?if=<?=htmlspecialchars($if);?>&amp;id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="edit" /></a></td>
1262
			<td valign="middle"><a href="services_dhcp.php?if=<?=htmlspecialchars($if);?>&amp;act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this mapping?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="delete" /></a></td>
1263
			</tr>
1264
			</table>
1265
		</td>
1266
		</tr>
1267
		<?php $i++; endforeach; ?>
1268
		<?php endif; ?>
1269
		<tr>
1270
		<td class="list" colspan="5"></td>
1271
		<td class="list">
1272
			<table border="0" cellspacing="0" cellpadding="1" summary="add">
1273
			<tr>
1274
			<td valign="middle" width="17"></td>
1275
			<td valign="middle"><a href="services_dhcp_edit.php?if=<?=htmlspecialchars($if);?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="add" /></a></td>
1276
			</tr>
1277
			</table>
1278
		</td>
1279
		</tr>
1280
		</table>
1281
		<?php endif; ?>
1282
	</div>
1283
</td>
1284
</tr>
1285
</table>
1286
</form>
1287
<script type="text/javascript">
1288
//<![CDATA[
1289
enable_change(false);
1290
//]]>
1291
</script>
1292
<?php include("fend.inc"); ?>
1293
</body>
1294
</html>
(150-150/256)