Project

General

Profile

Download (56.8 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'])) {
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
	} else {
512
		$retvaldhcp = services_dhcpd_configure();
513
		if ($retvaldhcp == 0)
514
			clear_subsystem_dirty('staticmaps');
515
	}
516
	if ($dhcpd_enable_changed)
517
		$retvalfc = filter_configure();
518

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

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

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

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

    
551
include("head.inc");
552

    
553
?>
554

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

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

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

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

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

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

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

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

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

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

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

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

    
1186
				</td>
1187
			</tr>
1188
			<?php endif; ?>
1189
			<tr>
1190
			<td width="22%" valign="top">&nbsp;</td>
1191
			<td width="78%">
1192
				<?php if ($act == "newpool"): ?>
1193
				<input type="hidden" name="act" value="newpool" />
1194
				<?php endif; ?>
1195
				<?php if (is_numeric($pool)): ?>
1196
				<input type="hidden" name="pool" value="<?php echo $pool; ?>" />
1197
				<?php endif; ?>
1198
				<input name="if" type="hidden" value="<?=htmlspecialchars($if);?>" />
1199
				<input name="submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onclick="enable_change(true)" />
1200
			</td>
1201
			</tr>
1202
			<tr>
1203
			<td width="22%" valign="top">&nbsp;</td>
1204
			<td width="78%"> <p><span class="vexpl"><span class="red"><strong><?=gettext("Note:");?><br />
1205
				</strong></span><?=gettext("The DNS servers entered in"); ?> <a href="system.php"><?=gettext("System: " .
1206
				"General setup"); ?></a> <?=gettext("(or the"); ?> <a href="services_dnsmasq.php"><?=gettext("DNS " .
1207
				"forwarder"); ?></a>, <?=gettext("if enabled)"); ?> </span><span class="vexpl"><?=gettext("will " .
1208
				"be assigned to clients by the DHCP server."); ?><br />
1209
				<br />
1210
				<?=gettext("The DHCP lease table can be viewed on the"); ?> <a href="status_dhcp_leases.php"><?=gettext("Status: " .
1211
				"DHCP leases"); ?></a> <?=gettext("page."); ?><br />
1212
				</span></p>
1213
			</td>
1214
			</tr>
1215
		</table>
1216
		<?php if (!is_numeric($pool) && !($act == "newpool")): ?>
1217
		<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="static mappings">
1218
		<tr>
1219
			<td colspan="5" valign="top" class="listtopic"><?=gettext("DHCP Static Mappings for this interface.");?></td>
1220
			<td>&nbsp;</td>
1221
		</tr>
1222
		<tr>
1223
			<td width="7%" class="listhdrr"><?=gettext("Static ARP");?></td>
1224
			<td width="18%" class="listhdrr"><?=gettext("MAC address");?></td>
1225
			<td width="15%" class="listhdrr"><?=gettext("IP address");?></td>
1226
			<td width="20%" class="listhdrr"><?=gettext("Hostname");?></td>
1227
			<td width="30%" class="listhdr"><?=gettext("Description");?></td>
1228
			<td width="10%" class="list">
1229
			<table border="0" cellspacing="0" cellpadding="1" summary="add">
1230
			<tr>
1231
			<td valign="middle" width="17"></td>
1232
			<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>
1233
			</tr>
1234
			</table>
1235
			</td>
1236
		</tr>
1237
			<?php if(is_array($a_maps)): ?>
1238
			<?php $i = 0; foreach ($a_maps as $mapent): ?>
1239
			<?php if($mapent['mac'] <> "" or $mapent['ipaddr'] <> ""): ?>
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 endif; ?>
1268
		<?php $i++; endforeach; ?>
1269
		<?php endif; ?>
1270
		<tr>
1271
		<td class="list" colspan="5"></td>
1272
		<td class="list">
1273
			<table border="0" cellspacing="0" cellpadding="1" summary="add">
1274
			<tr>
1275
			<td valign="middle" width="17"></td>
1276
			<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>
1277
			</tr>
1278
			</table>
1279
		</td>
1280
		</tr>
1281
		</table>
1282
		<?php endif; ?>
1283
	</div>
1284
</td>
1285
</tr>
1286
</table>
1287
</form>
1288
<script type="text/javascript">
1289
//<![CDATA[
1290
enable_change(false);
1291
//]]>
1292
</script>
1293
<?php include("fend.inc"); ?>
1294
</body>
1295
</html>
(150-150/256)