Projet

Général

Profil

Télécharger (57 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / usr / local / www / services_dhcp.php @ 565488c9

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
	All rights reserved.
9

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

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

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

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

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

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

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

    
51
/* This function will remove entries from dhcpd.leases that would otherwise
52
 * overlap with static DHCP reservations. If we don't clean these out,
53
 * then DHCP will print a warning in the logs about a duplicate lease
54
 */
55
function dhcp_clean_leases() {
56
	global $g, $config;
57
	$leasesfile = "{$g['dhcpd_chroot_path']}/var/db/dhcpd.leases";
58
	if (!file_exists($leasesfile))
59
		return;
60
	/* Build list of static MACs */
61
	$staticmacs = array();
62
	foreach($config['interfaces'] as $ifname => $ifarr)
63
		if (is_array($config['dhcpd'][$ifname]['staticmap']))
64
			foreach($config['dhcpd'][$ifname]['staticmap'] as $static)
65
				$staticmacs[] = $static['mac'];
66
	/* Read existing leases */
67
	$leases_contents = explode("\n", file_get_contents($leasesfile));
68
	$newleases_contents = array();
69
	$i=0;
70
	while ($i < count($leases_contents)) {
71
		/* Find a lease definition */
72
		if (substr($leases_contents[$i], 0, 6) == "lease ") {
73
			$templease = array();
74
			$thismac = "";
75
			/* Read to the end of the lease declaration */
76
			do {
77
				if (substr($leases_contents[$i], 0, 20) == "  hardware ethernet ")
78
					$thismac = substr($leases_contents[$i], 20, 17);
79
				$templease[] = $leases_contents[$i];
80
				$i++;
81
			} while ($leases_contents[$i-1] != "}");
82
			/* Check for a matching MAC address and if not present, keep it. */
83
			if (! in_array($thismac, $staticmacs))
84
				$newleases_contents = array_merge($newleases_contents, $templease);
85
		} else {
86
			/* It's a line we want to keep, copy it over. */
87
			$newleases_contents[] = $leases_contents[$i];
88
			$i++;
89
		}
90
	}
91
	/* Write out the new leases file */
92
	$fd = fopen($leasesfile, 'w');
93
	fwrite($fd, implode("\n", $newleases_contents));
94
	fclose($fd);
95
}
96

    
97
$if = $_GET['if'];
98
if (!empty($_POST['if']))
99
	$if = $_POST['if'];
100

    
101
/* if OLSRD is enabled, allow WAN to house DHCP. */
102
if($config['installedpackages']['olsrd']) {
103
	foreach($config['installedpackages']['olsrd']['config'] as $olsrd) {
104
			if($olsrd['enable']) {
105
				$is_olsr_enabled = true;
106
				break;
107
			}
108
	}
109
}
110

    
111
if (!$_GET['if'])
112
	$savemsg = gettext("The DHCP Server can only be enabled on interfaces configured with static IP addresses") . ".<br/><br/>" . gettext("Only interfaces configured with a static IP will be shown") . ".";
113

    
114
$iflist = get_configured_interface_with_descr();
115

    
116
/* set the starting interface */
117
if (!$if || !isset($iflist[$if])) {
118
	foreach ($iflist as $ifent => $ifname) {
119
		$oc = $config['interfaces'][$ifent];
120
		if ((is_array($config['dhcpd'][$ifent]) && !isset($config['dhcpd'][$ifent]['enable']) && (!is_ipaddrv4($oc['ipaddr']))) ||
121
			(!is_array($config['dhcpd'][$ifent]) && (!is_ipaddrv4($oc['ipaddr']))))
122
			continue;
123
		$if = $ifent;
124
		break;
125
	}
126
}
127

    
128
$act = $_GET['act'];
129
if (!empty($_POST['act']))
130
	$act = $_POST['act'];
131

    
132
$a_pools = array();
133

    
134
if (is_array($config['dhcpd'][$if])){
135
	$pool = $_GET['pool'];
136
	if (is_numeric($_POST['pool']))
137
		$pool = $_POST['pool'];
138

    
139
	// If we have a pool but no interface name, that's not valid. Redirect away.
140
	if (is_numeric($pool) && empty($if)) {
141
		header("Location: services_dhcp.php");
142
		exit;
143
	}
144

    
145
	if (!is_array($config['dhcpd'][$if]['pool']))
146
		$config['dhcpd'][$if]['pool'] = array();
147
	$a_pools = &$config['dhcpd'][$if]['pool'];
148

    
149
	if (is_numeric($pool) && $a_pools[$pool])
150
		$dhcpdconf = &$a_pools[$pool];
151
	elseif ($act == "newpool")
152
		$dhcpdconf = array();
153
	else
154
		$dhcpdconf = &$config['dhcpd'][$if];
155
}
156
if (is_array($dhcpdconf)) {
157
	// Global Options
158
	if (!is_numeric($pool) && !($act == "newpool")) {
159
		$pconfig['enable'] = isset($dhcpdconf['enable']);
160
		$pconfig['staticarp'] = isset($dhcpdconf['staticarp']);
161
		// No reason to specify this per-pool, per the dhcpd.conf man page it needs to be in every
162
		//   pool and should be specified in every pool both nodes share, so we'll treat it as global
163
		$pconfig['failover_peerip'] = $dhcpdconf['failover_peerip'];
164
		$pconfig['dhcpleaseinlocaltime'] = $dhcpdconf['dhcpleaseinlocaltime'];
165
		if (!is_array($dhcpdconf['staticmap']))
166
			$dhcpdconf['staticmap'] = array();
167
		$a_maps = &$dhcpdconf['staticmap'];
168
	} else {
169
		// Options that exist only in pools
170
		$pconfig['descr'] = $dhcpdconf['descr'];
171
	}
172

    
173
	// Options that can be global or per-pool.
174
	if (is_array($dhcpdconf['range'])) {
175
		$pconfig['range_from'] = $dhcpdconf['range']['from'];
176
		$pconfig['range_to'] = $dhcpdconf['range']['to'];
177
	}
178
	$pconfig['deftime'] = $dhcpdconf['defaultleasetime'];
179
	$pconfig['maxtime'] = $dhcpdconf['maxleasetime'];
180
	$pconfig['gateway'] = $dhcpdconf['gateway'];
181
	$pconfig['domain'] = $dhcpdconf['domain'];
182
	$pconfig['domainsearchlist'] = $dhcpdconf['domainsearchlist'];
183
	list($pconfig['wins1'],$pconfig['wins2']) = $dhcpdconf['winsserver'];
184
	list($pconfig['dns1'],$pconfig['dns2']) = $dhcpdconf['dnsserver'];
185
	$pconfig['denyunknown'] = isset($dhcpdconf['denyunknown']);
186
	$pconfig['ddnsdomain'] = $dhcpdconf['ddnsdomain'];
187
	$pconfig['ddnsdomainprimary'] = $dhcpdconf['ddnsdomainprimary'];
188
	$pconfig['ddnsdomainkeyname'] = $dhcpdconf['ddnsdomainkeyname'];
189
	$pconfig['ddnsdomainkey'] = $dhcpdconf['ddnsdomainkey'];
190
	$pconfig['ddnsupdate'] = isset($dhcpdconf['ddnsupdate']);
191
	$pconfig['mac_allow'] = $dhcpdconf['mac_allow'];
192
	$pconfig['mac_deny'] = $dhcpdconf['mac_deny'];
193
	list($pconfig['ntp1'],$pconfig['ntp2']) = $dhcpdconf['ntpserver'];
194
	$pconfig['tftp'] = $dhcpdconf['tftp'];
195
	$pconfig['ldap'] = $dhcpdconf['ldap'];
196
	$pconfig['netboot'] = isset($dhcpdconf['netboot']);
197
	$pconfig['nextserver'] = $dhcpdconf['nextserver'];
198
	$pconfig['filename'] = $dhcpdconf['filename'];
199
	$pconfig['filename32'] = $dhcpdconf['filename32'];
200
	$pconfig['filename64'] = $dhcpdconf['filename64'];
201
	$pconfig['rootpath'] = $dhcpdconf['rootpath'];
202
	$pconfig['netmask'] = $dhcpdconf['netmask'];
203
	$pconfig['numberoptions'] = $dhcpdconf['numberoptions'];
204
}
205

    
206
$ifcfgip = $config['interfaces'][$if]['ipaddr'];
207
$ifcfgsn = $config['interfaces'][$if]['subnet'];
208

    
209
function validate_partial_mac_list($maclist) {
210
	$macs = explode(',', $maclist);
211

    
212
	// Loop through and look for invalid MACs.
213
	foreach ($macs as $mac)
214
		if (!is_macaddr($mac, true))
215
			return false;
216
	return true;
217
}
218

    
219
if (isset($_POST['submit'])) {
220

    
221
	unset($input_errors);
222

    
223
	$pconfig = $_POST;
224

    
225
	$numberoptions = array();
226
	for($x=0; $x<99; $x++) {
227
		if(isset($_POST["number{$x}"]) && ctype_digit($_POST["number{$x}"])) {
228
			$numbervalue = array();
229
			$numbervalue['number'] = htmlspecialchars($_POST["number{$x}"]);
230
			$numbervalue['type'] = htmlspecialchars($_POST["itemtype{$x}"]);
231
			$numbervalue['value'] = str_replace('&quot;', '"', htmlspecialchars($_POST["value{$x}"]));
232
			$numberoptions['item'][] = $numbervalue;
233
		}
234
	}
235
	// Reload the new pconfig variable that the forum uses.
236
	$pconfig['numberoptions'] = $numberoptions;
237

    
238
	/* input validation */
239
	if ($_POST['enable'] || is_numeric($pool) || $act == "newpool") {
240
		$reqdfields = explode(" ", "range_from range_to");
241
		$reqdfieldsn = array(gettext("Range begin"),gettext("Range end"));
242

    
243
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
244

    
245
		if (($_POST['range_from'] && !is_ipaddrv4($_POST['range_from'])))
246
			$input_errors[] = gettext("A valid range must be specified.");
247
		if (($_POST['range_to'] && !is_ipaddrv4($_POST['range_to'])))
248
			$input_errors[] = gettext("A valid range must be specified.");
249
		if (($_POST['gateway'] && $_POST['gateway'] != "none" && !is_ipaddrv4($_POST['gateway'])))
250
			$input_errors[] = gettext("A valid IP address must be specified for the gateway.");
251
		if (($_POST['wins1'] && !is_ipaddrv4($_POST['wins1'])) || ($_POST['wins2'] && !is_ipaddrv4($_POST['wins2'])))
252
			$input_errors[] = gettext("A valid IP address must be specified for the primary/secondary WINS servers.");
253
		$parent_ip = get_interface_ip($_POST['if']);
254
		if (is_ipaddrv4($parent_ip) && $_POST['gateway'] && $_POST['gateway'] != "none") {
255
			$parent_sn = get_interface_subnet($_POST['if']);
256
			if(!ip_in_subnet($_POST['gateway'], gen_subnet($parent_ip, $parent_sn) . "/" . $parent_sn) && !ip_in_interface_alias_subnet($_POST['if'], $_POST['gateway']))
257
				$input_errors[] = sprintf(gettext("The gateway address %s does not lie within the chosen interface's subnet."), $_POST['gateway']);
258
		}
259
		if (($_POST['dns1'] && !is_ipaddrv4($_POST['dns1'])) || ($_POST['dns2'] && !is_ipaddrv4($_POST['dns2'])))
260
			$input_errors[] = gettext("A valid IP address must be specified for the primary/secondary DNS servers.");
261

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

    
265
		if (isset($config['captiveportal']) && is_array($config['captiveportal'])) {
266
			$deftime = 7200; // Default value if it's empty
267
			if (is_numeric($_POST['deftime']))
268
				$deftime = $_POST['deftime'];
269

    
270
			foreach ($config['captiveportal'] as $cpZone => $cpdata) {
271
				if (!isset($cpdata['enable']))
272
					continue;
273
				if (!isset($cpdata['timeout']) || !is_numeric($cpdata['timeout']))
274
					continue;
275
				$cp_ifs = explode(',', $cpdata['interface']);
276
				if (!in_array($if, $cp_ifs))
277
					continue;
278
				if ($cpdata['timeout'] > $deftime)
279
					$input_errors[] = sprintf(gettext(
280
						"The Captive Portal zone '%s' has Hard Timeout parameter set to a value bigger than Default lease time (%s)."), $cpZone, $deftime);
281
			}
282
		}
283

    
284
		if ($_POST['maxtime'] && (!is_numeric($_POST['maxtime']) || ($_POST['maxtime'] < 60) || ($_POST['maxtime'] <= $_POST['deftime'])))
285
			$input_errors[] = gettext("The maximum lease time must be at least 60 seconds and higher than the default lease time.");
286
		if (($_POST['ddnsdomain'] && !is_domain($_POST['ddnsdomain'])))
287
			$input_errors[] = gettext("A valid domain name must be specified for the dynamic DNS registration.");
288
		if (($_POST['ddnsdomain'] && !is_ipaddrv4($_POST['ddnsdomainprimary'])))
289
			$input_errors[] = gettext("A valid primary domain name server IP address must be specified for the dynamic domain name.");
290
		if (($_POST['ddnsdomainkey'] && !$_POST['ddnsdomainkeyname']) ||
291
			($_POST['ddnsdomainkeyname'] && !$_POST['ddnsdomainkey']))
292
			$input_errors[] = gettext("You must specify both a valid domain key and key name.");
293
		if ($_POST['domainsearchlist']) {
294
			$domain_array=preg_split("/[ ;]+/",$_POST['domainsearchlist']);
295
			foreach ($domain_array as $curdomain) {
296
				if (!is_domain($curdomain)) {
297
					$input_errors[] = gettext("A valid domain search list must be specified.");
298
					break;
299
				}
300
			}
301
		}
302

    
303
		// Validate MACs
304
		if (!empty($_POST['mac_allow']) && !validate_partial_mac_list($_POST['mac_allow']))
305
			$input_errors[] = gettext("If you specify a mac allow list, it must contain only valid partial MAC addresses.");
306
		if (!empty($_POST['mac_deny']) && !validate_partial_mac_list($_POST['mac_deny']))
307
			$input_errors[] = gettext("If you specify a mac deny list, it must contain only valid partial MAC addresses.");
308

    
309
		if (($_POST['ntp1'] && !is_ipaddrv4($_POST['ntp1'])) || ($_POST['ntp2'] && !is_ipaddrv4($_POST['ntp2'])))
310
			$input_errors[] = gettext("A valid IP address must be specified for the primary/secondary NTP servers.");
311
		if (($_POST['domain'] && !is_domain($_POST['domain'])))
312
			$input_errors[] = gettext("A valid domain name must be specified for the DNS domain.");
313
		if ($_POST['tftp'] && !is_ipaddrv4($_POST['tftp']) && !is_domain($_POST['tftp']) && !is_URL($_POST['tftp']))
314
			$input_errors[] = gettext("A valid IP address or hostname must be specified for the TFTP server.");
315
		if (($_POST['nextserver'] && !is_ipaddrv4($_POST['nextserver'])))
316
			$input_errors[] = gettext("A valid IP address must be specified for the network boot server.");
317

    
318
		if(gen_subnet($ifcfgip, $ifcfgsn) == $_POST['range_from'])
319
			$input_errors[] = gettext("You cannot use the network address in the starting subnet range.");
320
		if(gen_subnet_max($ifcfgip, $ifcfgsn) == $_POST['range_to'])
321
			$input_errors[] = gettext("You cannot use the broadcast address in the ending subnet range.");
322

    
323
		// Disallow a range that includes the virtualip
324
		if (is_array($config['virtualip']['vip'])) {
325
			foreach($config['virtualip']['vip'] as $vip) {
326
				if($vip['interface'] == $if)
327
					if($vip['subnet'] && is_inrange_v4($vip['subnet'], $_POST['range_from'], $_POST['range_to']))
328
						$input_errors[] = sprintf(gettext("The subnet range cannot overlap with virtual IP address %s."),$vip['subnet']);
329
			}
330
		}
331

    
332
		$noip = false;
333
		if(is_array($a_maps))
334
			foreach ($a_maps as $map)
335
				if (empty($map['ipaddr']))
336
					$noip = true;
337
		if ($_POST['staticarp'] && $noip)
338
			$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.";
339

    
340
		if(is_array($pconfig['numberoptions']['item'])) {
341
			foreach ($pconfig['numberoptions']['item'] as $numberoption) {
342
				if ( $numberoption['type'] == 'text' && strstr($numberoption['value'], '"') )
343
					$input_errors[] = gettext("Text type cannot include quotation marks.");
344
				else if ( $numberoption['type'] == 'string' && !preg_match('/^"[^"]*"$/', $numberoption['value']) && !preg_match('/^[0-9a-f]{2}(?:\:[0-9a-f]{2})*$/i', $numberoption['value']) )
345
					$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");
346
				else if ( $numberoption['type'] == 'boolean' && $numberoption['value'] != 'true' && $numberoption['value'] != 'false' && $numberoption['value'] != 'on' && $numberoption['value'] != 'off' )
347
					$input_errors[] = gettext("Boolean type must be true, false, on, or off.");
348
				else if ( $numberoption['type'] == 'unsigned integer 8' && (!is_numeric($numberoption['value']) || $numberoption['value'] < 0 || $numberoption['value'] > 255) )
349
					$input_errors[] = gettext("Unsigned 8-bit integer type must be a number in the range 0 to 255.");
350
				else if ( $numberoption['type'] == 'unsigned integer 16' && (!is_numeric($numberoption['value']) || $numberoption['value'] < 0 || $numberoption['value'] > 65535) )
351
					$input_errors[] = gettext("Unsigned 16-bit integer type must be a number in the range 0 to 65535.");
352
				else if ( $numberoption['type'] == 'unsigned integer 32' && (!is_numeric($numberoption['value']) || $numberoption['value'] < 0 || $numberoption['value'] > 4294967295) )
353
					$input_errors[] = gettext("Unsigned 32-bit integer type must be a number in the range 0 to 4294967295.");
354
				else if ( $numberoption['type'] == 'signed integer 8' && (!is_numeric($numberoption['value']) || $numberoption['value'] < -128 || $numberoption['value'] > 127) )
355
					$input_errors[] = gettext("Signed 8-bit integer type must be a number in the range -128 to 127.");
356
				else if ( $numberoption['type'] == 'signed integer 16' && (!is_numeric($numberoption['value']) || $numberoption['value'] < -32768 || $numberoption['value'] > 32767) )
357
					$input_errors[] = gettext("Signed 16-bit integer type must be a number in the range -32768 to 32767.");
358
				else if ( $numberoption['type'] == 'signed integer 32' && (!is_numeric($numberoption['value']) || $numberoption['value'] < -2147483648 || $numberoption['value'] > 2147483647) )
359
					$input_errors[] = gettext("Signed 32-bit integer type must be a number in the range -2147483648 to 2147483647.");
360
				else if ( $numberoption['type'] == 'ip-address' && !is_ipaddrv4($numberoption['value']) && !is_hostname($numberoption['value']) )
361
					$input_errors[] = gettext("IP address or host type must be an IP address or host name.");
362
			}
363
		}
364

    
365
		if (!$input_errors) {
366
			/* make sure the range lies within the current subnet */
367
			$subnet_start = ip2ulong(long2ip32(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn)));
368
			$subnet_end = ip2ulong(long2ip32(ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn))));
369

    
370
			if ((ip2ulong($_POST['range_from']) < $subnet_start) || (ip2ulong($_POST['range_from']) > $subnet_end) ||
371
			    (ip2ulong($_POST['range_to']) < $subnet_start) || (ip2ulong($_POST['range_to']) > $subnet_end)) {
372
				$input_errors[] = gettext("The specified range lies outside of the current subnet.");
373
			}
374

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

    
378
			if (is_numeric($pool) || ($act == "newpool")) {
379
				$rfrom = $config['dhcpd'][$if]['range']['from'];
380
				$rto = $config['dhcpd'][$if]['range']['to'];
381

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

    
386
			foreach ($a_pools as $id => $p) {
387
				if (is_numeric($pool) && ($id == $pool))
388
					continue;
389

    
390
				if (is_inrange_v4($_POST['range_from'], $p['range']['from'], $p['range']['to']) ||
391
				    is_inrange_v4($_POST['range_to'], $p['range']['from'], $p['range']['to'])) {
392
					$input_errors[] = gettext("The specified range must not be within the range configured on a DHCP pool for this interface.");
393
					break;
394
				}
395
			}
396

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

    
401
			$dynsubnet_start = ip2ulong($_POST['range_from']);
402
			$dynsubnet_end = ip2ulong($_POST['range_to']);
403
			if (is_array($a_maps)) {
404
				foreach ($a_maps as $map) {
405
					if (empty($map['ipaddr']))
406
						continue;
407
					if ((ip2ulong($map['ipaddr']) > $dynsubnet_start) &&
408
						(ip2ulong($map['ipaddr']) < $dynsubnet_end)) {
409
						$input_errors[] = sprintf(gettext("The DHCP range cannot overlap any static DHCP mappings."));
410
						break;
411
					}
412
				}
413
			}
414
		}
415
	}
416

    
417
	if (!$input_errors) {
418
		if (!is_numeric($pool)) {
419
			if ($act == "newpool") {
420
				$dhcpdconf = array();
421
			} else {
422
				if (!is_array($config['dhcpd'][$if]))
423
					$config['dhcpd'][$if] = array();
424
				$dhcpdconf = $config['dhcpd'][$if];
425
			}
426
		} else {
427
			if (is_array($a_pools[$pool])) {
428
				$dhcpdconf = $a_pools[$pool];
429
			} else {
430
				// Someone specified a pool but it doesn't exist. Punt.
431
				header("Location: services_dhcp.php");
432
				exit;
433
			}
434
		}
435
		if (!is_array($dhcpdconf['range']))
436
			$dhcpdconf['range'] = array();
437

    
438
		$dhcpd_enable_changed = false;
439

    
440
		// Global Options
441
		if (!is_numeric($pool) && !($act == "newpool")) {
442
			$old_dhcpd_enable = isset($dhcpdconf['enable']);
443
			$new_dhcpd_enable = ($_POST['enable']) ? true : false;
444
			if ($old_dhcpd_enable != $new_dhcpd_enable) {
445
				/* DHCP has been enabled or disabled. The pf ruleset will need to be rebuilt to allow or disallow DHCP. */
446
				$dhcpd_enable_changed = true;
447
			}
448
			$dhcpdconf['enable'] = $new_dhcpd_enable;
449
			$dhcpdconf['staticarp'] = ($_POST['staticarp']) ? true : false;
450
			$previous = $dhcpdconf['failover_peerip'];
451
			if($previous <> $_POST['failover_peerip'])
452
				mwexec("/bin/rm -rf /var/dhcpd/var/db/*");
453
			$dhcpdconf['failover_peerip'] = $_POST['failover_peerip'];
454
			$dhcpdconf['dhcpleaseinlocaltime'] = $_POST['dhcpleaseinlocaltime'];
455
		} else {
456
			// Options that exist only in pools
457
			$dhcpdconf['descr'] = $_POST['descr'];
458
		}
459

    
460
		// Options that can be global or per-pool.
461
		$dhcpdconf['range']['from'] = $_POST['range_from'];
462
		$dhcpdconf['range']['to'] = $_POST['range_to'];
463
		$dhcpdconf['defaultleasetime'] = $_POST['deftime'];
464
		$dhcpdconf['maxleasetime'] = $_POST['maxtime'];
465
		$dhcpdconf['netmask'] = $_POST['netmask'];
466

    
467
		unset($dhcpdconf['winsserver']);
468
		if ($_POST['wins1'])
469
			$dhcpdconf['winsserver'][] = $_POST['wins1'];
470
		if ($_POST['wins2'])
471
			$dhcpdconf['winsserver'][] = $_POST['wins2'];
472

    
473
		unset($dhcpdconf['dnsserver']);
474
		if ($_POST['dns1'])
475
			$dhcpdconf['dnsserver'][] = $_POST['dns1'];
476
		if ($_POST['dns2'])
477
			$dhcpdconf['dnsserver'][] = $_POST['dns2'];
478

    
479
		$dhcpdconf['gateway'] = $_POST['gateway'];
480
		$dhcpdconf['domain'] = $_POST['domain'];
481
		$dhcpdconf['domainsearchlist'] = $_POST['domainsearchlist'];
482
		$dhcpdconf['denyunknown'] = ($_POST['denyunknown']) ? true : false;
483
		$dhcpdconf['ddnsdomain'] = $_POST['ddnsdomain'];
484
		$dhcpdconf['ddnsdomainprimary'] = $_POST['ddnsdomainprimary'];
485
		$dhcpdconf['ddnsdomainkeyname'] = $_POST['ddnsdomainkeyname'];
486
		$dhcpdconf['ddnsdomainkey'] = $_POST['ddnsdomainkey'];
487
		$dhcpdconf['ddnsupdate'] = ($_POST['ddnsupdate']) ? true : false;
488
		$dhcpdconf['mac_allow'] = $_POST['mac_allow'];
489
		$dhcpdconf['mac_deny'] = $_POST['mac_deny'];
490

    
491
		unset($dhcpdconf['ntpserver']);
492
		if ($_POST['ntp1'])
493
			$dhcpdconf['ntpserver'][] = $_POST['ntp1'];
494
		if ($_POST['ntp2'])
495
			$dhcpdconf['ntpserver'][] = $_POST['ntp2'];
496

    
497
		$dhcpdconf['tftp'] = $_POST['tftp'];
498
		$dhcpdconf['ldap'] = $_POST['ldap'];
499
		$dhcpdconf['netboot'] = ($_POST['netboot']) ? true : false;
500
		$dhcpdconf['nextserver'] = $_POST['nextserver'];
501
		$dhcpdconf['filename'] = $_POST['filename'];
502
		$dhcpdconf['filename32'] = $_POST['filename32'];
503
		$dhcpdconf['filename64'] = $_POST['filename64'];
504
		$dhcpdconf['rootpath'] = $_POST['rootpath'];
505

    
506
		// Handle the custom options rowhelper
507
		if(isset($dhcpdconf['numberoptions']['item']))
508
			unset($dhcpdconf['numberoptions']['item']);
509

    
510
		$dhcpdconf['numberoptions'] = $numberoptions;
511

    
512
		if (is_numeric($pool) && is_array($a_pools[$pool])) {
513
			$a_pools[$pool] = $dhcpdconf;
514
		} elseif ($act == "newpool") {
515
			$a_pools[] = $dhcpdconf;
516
		} else {
517
			$config['dhcpd'][$if] = $dhcpdconf;
518
		}
519

    
520
		write_config();
521
	}
522
}
523

    
524
if (isset($_POST['submit']) || isset($_POST['apply'])) {
525
	$retval = 0;
526
	$retvaldhcp = 0;
527
	$retvaldns = 0;
528
	/* Stop DHCP so we can cleanup leases */
529
	killbyname("dhcpd");
530
	dhcp_clean_leases();
531
	/* dnsmasq_configure calls dhcpd_configure */
532
	/* no need to restart dhcpd twice */
533
	if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstatic']))	{
534
		$retvaldns = services_dnsmasq_configure();
535
		if ($retvaldns == 0) {
536
			clear_subsystem_dirty('hosts');
537
			clear_subsystem_dirty('staticmaps');
538
		}
539
	} else if (isset($config['unbound']['enable']) && isset($config['unbound']['regdhcpstatic'])) {
540
		$retvaldns = services_unbound_configure();
541
		if ($retvaldns == 0)
542
			clear_subsystem_dirty('unbound');
543
	} else {
544
		$retvaldhcp = services_dhcpd_configure();
545
		if ($retvaldhcp == 0)
546
			clear_subsystem_dirty('staticmaps');
547
	}
548
	if ($dhcpd_enable_changed)
549
		$retvalfc = filter_configure();
550

    
551
	if($retvaldhcp == 1 || $retvaldns == 1 || $retvalfc == 1)
552
		$retval = 1;
553
	$savemsg = get_std_save_message($retval);
554
}
555

    
556
if ($act == "delpool") {
557
	if ($a_pools[$_GET['id']]) {
558
		unset($a_pools[$_GET['id']]);
559
		write_config();
560
		header("Location: services_dhcp.php?if={$if}");
561
		exit;
562
	}
563
}
564

    
565
if ($act == "del") {
566
	if ($a_maps[$_GET['id']]) {
567
		unset($a_maps[$_GET['id']]);
568
		write_config();
569
		if(isset($config['dhcpd'][$if]['enable'])) {
570
			mark_subsystem_dirty('staticmaps');
571
			if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstatic']))
572
				mark_subsystem_dirty('hosts');
573
		}
574
		header("Location: services_dhcp.php?if={$if}");
575
		exit;
576
	}
577
}
578

    
579
$closehead = false;
580
$pgtitle = array(gettext("Services"),gettext("DHCP server"));
581
$shortcut_section = "dhcp";
582

    
583
include("head.inc");
584

    
585
?>
586

    
587
<script type="text/javascript" src="/javascript/row_helper.js">
588
</script>
589

    
590
<script type="text/javascript">
591
//<![CDATA[
592
	function itemtype_field(fieldname, fieldsize, n) {
593
		return '<select name="' + fieldname + n + '" class="formselect" id="' + fieldname + n + '"><?php
594
			$customitemtypes = array('text' => gettext('Text'), 'string' => gettext('String'), 'boolean' => gettext('Boolean'),
595
				'unsigned integer 8' => gettext('Unsigned 8-bit integer'), 'unsigned integer 16' => gettext('Unsigned 16-bit integer'), 'unsigned integer 32' => gettext('Unsigned 32-bit integer'),
596
				'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'));
597
			foreach ($customitemtypes as $typename => $typedescr) {
598
				echo "<option value=\"{$typename}\">{$typedescr}<\/option>";
599
			}
600
		?><\/select>';
601
	}
602

    
603
	rowname[0] = "number";
604
	rowtype[0] = "textbox";
605
	rowsize[0] = "10";
606
	rowname[1] = "itemtype";
607
	rowtype[1] = itemtype_field;
608
	rowname[2] = "value";
609
	rowtype[2] = "textbox";
610
	rowsize[2] = "40";
611
//]]>
612
</script>
613

    
614
<script type="text/javascript">
615
//<![CDATA[
616
	function enable_change(enable_over) {
617
		var endis;
618
		<?php if (is_numeric($pool) || ($act == "newpool")): ?>
619
			enable_over = true;
620
		<?php endif; ?>
621
		endis = !(document.iform.enable.checked || enable_over);
622
		<?php if (is_numeric($pool) || ($act == "newpool")): ?>
623
			document.iform.descr.disabled = endis;
624
		<?php endif; ?>
625
		document.iform.range_from.disabled = endis;
626
		document.iform.range_to.disabled = endis;
627
		document.iform.wins1.disabled = endis;
628
		document.iform.wins2.disabled = endis;
629
		document.iform.dns1.disabled = endis;
630
		document.iform.dns2.disabled = endis;
631
		document.iform.deftime.disabled = endis;
632
		document.iform.maxtime.disabled = endis;
633
		document.iform.gateway.disabled = endis;
634
		document.iform.failover_peerip.disabled = endis;
635
		document.iform.domain.disabled = endis;
636
		document.iform.domainsearchlist.disabled = endis;
637
		document.iform.staticarp.disabled = endis;
638
		document.iform.dhcpleaseinlocaltime.disabled = endis;
639
		document.iform.ddnsdomain.disabled = endis;
640
		document.iform.ddnsdomainprimary.disabled = endis;
641
		document.iform.ddnsdomainkeyname.disabled = endis;
642
		document.iform.ddnsdomainkey.disabled = endis;
643
		document.iform.ddnsupdate.disabled = endis;
644
		document.iform.mac_allow.disabled = endis;
645
		document.iform.mac_deny.disabled = endis;
646
		document.iform.ntp1.disabled = endis;
647
		document.iform.ntp2.disabled = endis;
648
		document.iform.tftp.disabled = endis;
649
		document.iform.ldap.disabled = endis;
650
		document.iform.netboot.disabled = endis;
651
		document.iform.nextserver.disabled = endis;
652
		document.iform.filename.disabled = endis;
653
		document.iform.filename32.disabled = endis;
654
		document.iform.filename64.disabled = endis;
655
		document.iform.rootpath.disabled = endis;
656
		document.iform.denyunknown.disabled = endis;
657
	}
658

    
659
	function show_shownumbervalue() {
660
		document.getElementById("shownumbervaluebox").innerHTML='';
661
		aodiv = document.getElementById('shownumbervalue');
662
		aodiv.style.display = "block";
663
	}
664

    
665
	function show_ddns_config() {
666
		document.getElementById("showddnsbox").innerHTML='';
667
		aodiv = document.getElementById('showddns');
668
		aodiv.style.display = "block";
669
	}
670

    
671
	function show_maccontrol_config() {
672
		document.getElementById("showmaccontrolbox").innerHTML='';
673
		aodiv = document.getElementById('showmaccontrol');
674
		aodiv.style.display = "block";
675
	}
676

    
677
	function show_ntp_config() {
678
		document.getElementById("showntpbox").innerHTML='';
679
		aodiv = document.getElementById('showntp');
680
		aodiv.style.display = "block";
681
	}
682

    
683
	function show_tftp_config() {
684
		document.getElementById("showtftpbox").innerHTML='';
685
		aodiv = document.getElementById('showtftp');
686
		aodiv.style.display = "block";
687
	}
688

    
689
	function show_ldap_config() {
690
		document.getElementById("showldapbox").innerHTML='';
691
		aodiv = document.getElementById('showldap');
692
		aodiv.style.display = "block";
693
	}
694

    
695
	function show_netboot_config() {
696
		document.getElementById("shownetbootbox").innerHTML='';
697
		aodiv = document.getElementById('shownetboot');
698
		aodiv.style.display = "block";
699
	}
700
//]]>
701
</script>
702
</head>
703

    
704
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
705
<?php include("fbegin.inc"); ?>
706
<form action="services_dhcp.php" method="post" name="iform" id="iform">
707
<?php if ($input_errors) print_input_errors($input_errors); ?>
708
<?php if ($savemsg) print_info_box($savemsg); ?>
709
<?php
710
	if (isset($config['dhcrelay']['enable'])) {
711
		echo gettext("DHCP Relay is currently enabled. Cannot enable the DHCP Server service while the DHCP Relay is enabled on any interface.");
712
		include("fend.inc");
713
		echo "</body>";
714
		echo "</html>";
715
		exit;
716
	}
717
?>
718
<?php if (is_subsystem_dirty('staticmaps')): ?><br/>
719
<?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 />
720
<?php endif; ?>
721
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="dhcp server">
722
<tr><td>
723
<?php
724
	/* active tabs */
725
	$tab_array = array();
726
	$tabscounter = 0;
727
	$i = 0;
728
	foreach ($iflist as $ifent => $ifname) {
729
		$oc = $config['interfaces'][$ifent];
730
		if ((is_array($config['dhcpd'][$ifent]) && !isset($config['dhcpd'][$ifent]['enable']) && (!is_ipaddrv4($oc['ipaddr']))) ||
731
			(!is_array($config['dhcpd'][$ifent]) && (!is_ipaddrv4($oc['ipaddr']))))
732
			continue;
733
		if ($ifent == $if)
734
			$active = true;
735
		else
736
			$active = false;
737
		$tab_array[] = array($ifname, $active, "services_dhcp.php?if={$ifent}");
738
		$tabscounter++;
739
	}
740
	if ($tabscounter == 0) {
741
		echo "</td></tr></table></form>";
742
		include("fend.inc");
743
		echo "</body>";
744
		echo "</html>";
745
		exit;
746
	}
747
	display_top_tabs($tab_array);
748
?>
749
</td></tr>
750
<tr>
751
<td>
752
	<div id="mainarea">
753
		<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
754
			<?php if (!is_numeric($pool) && !($act == "newpool")): ?>
755
			<tr>
756
			<td width="22%" valign="top" class="vtable">&nbsp;</td>
757
			<td width="78%" class="vtable">
758
				<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onclick="enable_change(false)" />
759
			<strong><?php printf(gettext("Enable DHCP server on " .
760
			"%s " .
761
			"interface"),htmlspecialchars($iflist[$if]));?></strong></td>
762
			</tr>
763
			<?php else: ?>
764
			<tr>
765
				<td colspan="2" class="listtopic"><?php echo gettext("Editing Pool-Specific Options. To return to the Interface, click its tab above."); ?></td>
766
			</tr>
767
			<?php endif; ?>
768
			<tr>
769
			<td width="22%" valign="top" class="vtable">&nbsp;</td>
770
			<td width="78%" class="vtable">
771
				<input name="denyunknown" id="denyunknown" type="checkbox" value="yes" <?php if ($pconfig['denyunknown']) echo "checked=\"checked\""; ?> />
772
				<strong><?=gettext("Deny unknown clients");?></strong><br />
773
				<?=gettext("If this is checked, only the clients defined below will get DHCP leases from this server. ");?></td>
774
			</tr>
775
			<?php if (is_numeric($pool) || ($act == "newpool")): ?>
776
				<tr>
777
				<td width="22%" valign="top" class="vncell"><?=gettext("Pool Description");?></td>
778
				<td width="78%" class="vtable">
779
					<input name="descr" type="text" class="formfld unknown" id="descr" size="20" value="<?=htmlspecialchars($pconfig['descr']);?>" />
780
				</td>
781
				</tr>
782
			<?php endif; ?>
783
			<tr>
784
			<td width="22%" valign="top" class="vncellreq"><?=gettext("Subnet");?></td>
785
			<td width="78%" class="vtable">
786
				<?=gen_subnet($ifcfgip, $ifcfgsn);?>
787
			</td>
788
			</tr>
789
			<tr>
790
			<td width="22%" valign="top" class="vncellreq"><?=gettext("Subnet mask");?></td>
791
			<td width="78%" class="vtable">
792
				<?=gen_subnet_mask($ifcfgsn);?>
793
			</td>
794
			</tr>
795
			<tr>
796
			<td width="22%" valign="top" class="vncellreq"><?=gettext("Available range");?></td>
797
			<td width="78%" class="vtable">
798
			<?php
799
				$range_from = ip2long(long2ip32(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn)));
800
				$range_from++;
801
				echo long2ip32($range_from);
802
			?>
803
			-
804
			<?php
805
				$range_to = ip2long(long2ip32(ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn))));
806
				$range_to--;
807
				echo long2ip32($range_to);
808
			?>
809
			<?php if (is_numeric($pool) || ($act == "newpool")): ?>
810
				<br />In-use DHCP Pool Ranges:
811
				<?php if (is_array($config['dhcpd'][$if]['range'])): ?>
812
					<br /><?php echo $config['dhcpd'][$if]['range']['from']; ?>-<?php echo $config['dhcpd'][$if]['range']['to']; ?>
813
				<?php endif; ?>
814
				<?php foreach ($a_pools as $p): ?>
815
					<?php if (is_array($p['range'])): ?>
816
					<br /><?php echo $p['range']['from']; ?>-<?php echo $p['range']['to']; ?>
817
					<?php endif; ?>
818
				<?php endforeach; ?>
819
			<?php endif; ?>
820
			</td>
821
			</tr>
822
			<?php if($is_olsr_enabled): ?>
823
			<tr>
824
			<td width="22%" valign="top" class="vncellreq"><?=gettext("Subnet Mask");?></td>
825
			<td width="78%" class="vtable">
826
				<select name="netmask" class="formselect" id="netmask">
827
				<?php
828
				for ($i = 32; $i > 0; $i--) {
829
					if($i <> 31) {
830
						echo "<option value=\"{$i}\" ";
831
						if ($i == $pconfig['netmask']) echo "selected=\"selected\"";
832
						echo ">" . $i . "</option>";
833
					}
834
				}
835
				?>
836
				</select>
837
			</td>
838
			</tr>
839
			<?php endif; ?>
840
			<tr>
841
			<td width="22%" valign="top" class="vncellreq"><?=gettext("Range");?></td>
842
			<td width="78%" class="vtable">
843
				<input name="range_from" type="text" class="formfld unknown" id="range_from" size="20" value="<?=htmlspecialchars($pconfig['range_from']);?>" />
844
				&nbsp;<?=gettext("to"); ?>&nbsp; <input name="range_to" type="text" class="formfld unknown" id="range_to" size="20" value="<?=htmlspecialchars($pconfig['range_to']);?>" />
845
			</td>
846
			</tr>
847
			<?php if (!is_numeric($pool) && !($act == "newpool")): ?>
848
			<tr>
849
			<td width="22%" valign="top" class="vncell"><?=gettext("Additional Pools");?></td>
850
			<td width="78%" class="vtable">
851
				<?php echo gettext("If you need additional pools of addresses inside of this subnet outside the above Range, they may be specified here."); ?>
852
				<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="subnet">
853
				<tr>
854
					<td width="35%" class="listhdrr"><?=gettext("Pool Start");?></td>
855
					<td width="35%" class="listhdrr"><?=gettext("Pool End");?></td>
856
					<td width="20%" class="listhdrr"><?=gettext("Description");?></td>
857
					<td width="10%" class="list">
858
					<table border="0" cellspacing="0" cellpadding="1" summary="pool">
859
					<tr>
860
					<td valign="middle" width="17"></td>
861
					<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>
862
					</tr>
863
					</table>
864
					</td>
865
				</tr>
866
					<?php if(is_array($a_pools)): ?>
867
					<?php $i = 0; foreach ($a_pools as $poolent): ?>
868
					<?php if(!empty($poolent['range']['from']) && !empty($poolent['range']['to'])): ?>
869
				<tr>
870
				<td class="listlr" ondblclick="document.location='services_dhcp.php?if=<?=htmlspecialchars($if);?>&amp;pool=<?=$i;?>';">
871
					<?=htmlspecialchars($poolent['range']['from']);?>
872
				</td>
873
				<td class="listr" ondblclick="document.location='services_dhcp.php?if=<?=htmlspecialchars($if);?>&amp;pool=<?=$i;?>';">
874
					<?=htmlspecialchars($poolent['range']['to']);?>&nbsp;
875
				</td>
876
				<td class="listr" ondblclick="document.location='services_dhcp.php?if=<?=htmlspecialchars($if);?>&amp;pool=<?=$i;?>';">
877
					<?=htmlspecialchars($poolent['descr']);?>&nbsp;
878
				</td>
879
				<td valign="middle" class="list nowrap">
880
					<table border="0" cellspacing="0" cellpadding="1" summary="icons">
881
					<tr>
882
					<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>
883
					<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>
884
					</tr>
885
					</table>
886
				</td>
887
				</tr>
888
				<?php endif; ?>
889
				<?php $i++; endforeach; ?>
890
				<?php endif; ?>
891
				<tr>
892
				<td class="list" colspan="3"></td>
893
				<td class="list">
894
					<table border="0" cellspacing="0" cellpadding="1" summary="add">
895
					<tr>
896
					<td valign="middle" width="17"></td>
897
					<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>
898
					</tr>
899
					</table>
900
				</td>
901
				</tr>
902
				</table>
903
			</td>
904
			</tr>
905
			<?php endif; ?>
906
			<tr>
907
			<td width="22%" valign="top" class="vncell"><?=gettext("WINS servers");?></td>
908
			<td width="78%" class="vtable">
909
				<input name="wins1" type="text" class="formfld unknown" id="wins1" size="20" value="<?=htmlspecialchars($pconfig['wins1']);?>" /><br />
910
				<input name="wins2" type="text" class="formfld unknown" id="wins2" size="20" value="<?=htmlspecialchars($pconfig['wins2']);?>" />
911
			</td>
912
			</tr>
913
			<tr>
914
			<td width="22%" valign="top" class="vncell"><?=gettext("DNS servers");?></td>
915
			<td width="78%" class="vtable">
916
				<input name="dns1" type="text" class="formfld unknown" id="dns1" size="20" value="<?=htmlspecialchars($pconfig['dns1']);?>" /><br />
917
				<input name="dns2" type="text" class="formfld unknown" id="dns2" size="20" value="<?=htmlspecialchars($pconfig['dns2']);?>" /><br />
918
				<?=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.");?>
919
			</td>
920
			</tr>
921
			<tr>
922
			<td width="22%" valign="top" class="vncell"><?=gettext("Gateway");?></td>
923
			<td width="78%" class="vtable">
924
				<input name="gateway" type="text" class="formfld host" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>" /><br />
925
				<?=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.");?>
926
			</td>
927
			</tr>
928
			<tr>
929
			<td width="22%" valign="top" class="vncell"><?=gettext("Domain name");?></td>
930
			<td width="78%" class="vtable">
931
				<input name="domain" type="text" class="formfld unknown" id="domain" size="20" value="<?=htmlspecialchars($pconfig['domain']);?>" /><br />
932
				<?=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.");?>
933
			</td>
934
			</tr>
935
			<tr>
936
			<td width="22%" valign="top" class="vncell"><?=gettext("Domain search list");?></td>
937
			<td width="78%" class="vtable">
938
				<input name="domainsearchlist" type="text" class="formfld unknown" id="domainsearchlist" size="20" value="<?=htmlspecialchars($pconfig['domainsearchlist']);?>" /><br />
939
				<?=gettext("The DHCP server can optionally provide a domain search list. Use the semicolon character as separator ");?>
940
			</td>
941
			</tr>
942
			<tr>
943
			<td width="22%" valign="top" class="vncell"><?=gettext("Default lease time");?></td>
944
			<td width="78%" class="vtable">
945
				<input name="deftime" type="text" class="formfld unknown" id="deftime" size="10" value="<?=htmlspecialchars($pconfig['deftime']);?>" />
946
				<?=gettext("seconds");?><br />
947
				<?=gettext("This is used for clients that do not ask for a specific " .
948
				"expiration time."); ?><br />
949
				<?=gettext("The default is 7200 seconds.");?>
950
			</td>
951
			</tr>
952
			<tr>
953
			<td width="22%" valign="top" class="vncell"><?=gettext("Maximum lease time");?></td>
954
			<td width="78%" class="vtable">
955
				<input name="maxtime" type="text" class="formfld unknown" id="maxtime" size="10" value="<?=htmlspecialchars($pconfig['maxtime']);?>" />
956
				<?=gettext("seconds");?><br />
957
				<?=gettext("This is the maximum lease time for clients that ask".
958
				" for a specific expiration time."); ?><br />
959
				<?=gettext("The default is 86400 seconds.");?>
960
			</td>
961
			</tr>
962
			<?php if (!is_numeric($pool) && !($act == "newpool")): ?>
963
			<tr>
964
			<td width="22%" valign="top" class="vncell"><?=gettext("Failover peer IP:");?></td>
965
			<td width="78%" class="vtable">
966
				<input name="failover_peerip" type="text" class="formfld host" id="failover_peerip" size="20" value="<?=htmlspecialchars($pconfig['failover_peerip']);?>" /><br />
967
				<?=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).");?>
968
			</td>
969
			</tr>
970
			<?php endif; ?>
971
			<?php if (!is_numeric($pool) && !($act == "newpool")): ?>
972
			<tr>
973
			<td width="22%" valign="top" class="vncell"><?=gettext("Static ARP");?></td>
974
			<td width="78%" class="vtable">
975
				<table summary="static arp">
976
					<tr>
977
					<td>
978
						<input style="vertical-align:middle" type="checkbox" value="yes" name="staticarp" id="staticarp" <?php if($pconfig['staticarp']) echo " checked=\"checked\""; ?> />&nbsp;
979
					</td>
980
					<td><b><?=gettext("Enable Static ARP entries");?></b></td>
981
					</tr>
982
					<tr>
983
					<td>&nbsp;</td>
984
					<td>
985
						<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.");?>
986
					</td>
987
					</tr>
988
				</table>
989
			</td>
990
			</tr>
991
			<?php endif; ?>
992
			<?php if (!is_numeric($pool) && !($act == "newpool")): ?>
993
			<tr>
994
				<td width="22%" valign="top" class="vncell"><?=gettext("Time format change"); ?></td>
995
				<td width="78%" class="vtable">
996
				<table summary="time format">
997
					<tr>
998
					<td>
999
						<input name="dhcpleaseinlocaltime" type="checkbox" id="dhcpleaseinlocaltime" value="yes" <?php if ($pconfig['dhcpleaseinlocaltime']) echo "checked=\"checked\""; ?> />
1000
					</td>
1001
					<td>
1002
						<strong>
1003
							<?=gettext("Change DHCP display lease time from UTC to local time."); ?>
1004
						</strong>
1005
					</td>
1006
					</tr>
1007
					<tr>
1008
					<td>&nbsp;</td>
1009
					<td>
1010
						<span class="red"><strong><?=gettext("Note:");?></strong></span> <?=gettext("By default DHCP leases are displayed in UTC time.  By checking this
1011
						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."); ?>
1012
					</td>
1013
					</tr>
1014
				</table>
1015
				</td>
1016
			</tr>
1017
			<?php endif; ?>
1018
			<tr>
1019
			<td width="22%" valign="top" class="vncell"><?=gettext("Dynamic DNS");?></td>
1020
			<td width="78%" class="vtable">
1021
				<div id="showddnsbox">
1022
					<input type="button" onclick="show_ddns_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Dynamic DNS");?>
1023
				</div>
1024
				<div id="showddns" style="display:none">
1025
					<input style="vertical-align:middle" type="checkbox" value="yes" name="ddnsupdate" id="ddnsupdate" <?php if($pconfig['ddnsupdate']) echo " checked=\"checked\""; ?> />&nbsp;
1026
					<b><?=gettext("Enable registration of DHCP client names in DNS.");?></b><br />
1027
					<br/>
1028
					<input name="ddnsdomain" type="text" class="formfld unknown" id="ddnsdomain" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomain']);?>" /><br />
1029
					<?=gettext("Note: Leave blank to disable dynamic DNS registration.");?><br />
1030
					<?=gettext("Enter the dynamic DNS domain which will be used to register client names in the DNS server.");?>
1031
					<input name="ddnsdomainprimary" type="text" class="formfld unknown" id="ddnsdomainprimary" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomainprimary']);?>" /><br />
1032
					<?=gettext("Enter the primary domain name server IP address for the dynamic domain name.");?><br />
1033
					<input name="ddnsdomainkeyname" type="text" class="formfld unknown" id="ddnsdomainkeyname" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomainkeyname']);?>" /><br />
1034
					<?=gettext("Enter the dynamic DNS domain key name which will be used to register client names in the DNS server.");?>
1035
					<input name="ddnsdomainkey" type="text" class="formfld unknown" id="ddnsdomainkey" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomainkey']);?>" /><br />
1036
					<?=gettext("Enter the dynamic DNS domain key secret which will be used to register client names in the DNS server.");?>
1037
				</div>
1038
			</td>
1039
			</tr>
1040
			<tr>
1041
			<td width="22%" valign="top" class="vncell"><?=gettext("MAC Address Control");?></td>
1042
			<td width="78%" class="vtable">
1043
				<div id="showmaccontrolbox">
1044
					<input type="button" onclick="show_maccontrol_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show MAC Address Control");?>
1045
				</div>
1046
				<div id="showmaccontrol" style="display:none">
1047
					<input name="mac_allow" type="text" class="formfld unknown" id="mac_allow" size="20" value="<?=htmlspecialchars($pconfig['mac_allow']);?>" /><br />
1048
					<?=gettext("Enter a list of partial MAC addresses to allow, comma separated, no spaces, such as ");?>00:00:00,01:E5:FF
1049
					<input name="mac_deny" type="text" class="formfld unknown" id="mac_deny" size="20" value="<?=htmlspecialchars($pconfig['mac_deny']);?>" /><br />
1050
					<?=gettext("Enter a list of partial MAC addresses to deny access, comma separated, no spaces, such as ");?>00:00:00,01:E5:FF
1051
				</div>
1052
			</td>
1053
			</tr>
1054
			<tr>
1055
			<td width="22%" valign="top" class="vncell"><?=gettext("NTP servers");?></td>
1056
			<td width="78%" class="vtable">
1057
				<div id="showntpbox">
1058
					<input type="button" onclick="show_ntp_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show NTP configuration");?>
1059
				</div>
1060
				<div id="showntp" style="display:none">
1061
					<input name="ntp1" type="text" class="formfld unknown" id="ntp1" size="20" value="<?=htmlspecialchars($pconfig['ntp1']);?>" /><br />
1062
					<input name="ntp2" type="text" class="formfld unknown" id="ntp2" size="20" value="<?=htmlspecialchars($pconfig['ntp2']);?>" />
1063
				</div>
1064
			</td>
1065
			</tr>
1066
			<tr>
1067
			<td width="22%" valign="top" class="vncell"><?=gettext("TFTP server");?></td>
1068
			<td width="78%" class="vtable">
1069
			<div id="showtftpbox">
1070
				<input type="button" onclick="show_tftp_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show TFTP configuration");?>
1071
			</div>
1072
			<div id="showtftp" style="display:none">
1073
				<input name="tftp" type="text" class="formfld unknown" id="tftp" size="50" value="<?=htmlspecialchars($pconfig['tftp']);?>" /><br />
1074
				<?=gettext("Leave blank to disable.  Enter a full hostname or IP for the TFTP server.");?>
1075
			</div>
1076
			</td>
1077
			</tr>
1078
			<tr>
1079
			<td width="22%" valign="top" class="vncell"><?=gettext("LDAP URI");?></td>
1080
			<td width="78%" class="vtable">
1081
				<div id="showldapbox">
1082
					<input type="button" onclick="show_ldap_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show LDAP configuration");?>
1083
				</div>
1084
				<div id="showldap" style="display:none">
1085
					<input name="ldap" type="text" class="formfld unknown" id="ldap" size="80" value="<?=htmlspecialchars($pconfig['ldap']);?>" /><br />
1086
					<?=gettext("Leave blank to disable.  Enter a full URI for the LDAP server in the form ldap://ldap.example.com/dc=example,dc=com");?>
1087
				</div>
1088
			</td>
1089
			</tr>
1090
			<tr>
1091
			<td width="22%" valign="top" class="vncell"><?=gettext("Enable network booting");?></td>
1092
			<td width="78%" class="vtable">
1093
				<div id="shownetbootbox">
1094
					<input type="button" onclick="show_netboot_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Network booting");?>
1095
				</div>
1096
				<div id="shownetboot" style="display:none">
1097
					<input style="vertical-align:middle" type="checkbox" value="yes" name="netboot" id="netboot" <?php if($pconfig['netboot']) echo " checked=\"checked\""; ?> />&nbsp;
1098
					<b><?=gettext("Enables network booting.");?></b>
1099
					<br/>
1100
					<?=gettext("Enter the IP of the"); ?> <b><?=gettext("next-server"); ?></b>
1101
					<input name="nextserver" type="text" class="formfld unknown" id="nextserver" size="20" value="<?=htmlspecialchars($pconfig['nextserver']);?>" /><br />
1102
					<?=gettext("and the default bios filename");?>
1103
						<input name="filename" type="text" class="formfld unknown" id="filename" size="20" value="<?=htmlspecialchars($pconfig['filename']);?>" /><br />
1104
					<?=gettext("and the UEFI 32bit filename  ");?>
1105
						<input name="filename32" type="text" class="formfld unknown" id="filename32" size="20" value="<?=htmlspecialchars($pconfig['filename32']);?>" /><br />
1106
					<?=gettext("and the UEFI 64bit filename  ");?>
1107
						<input name="filename64" type="text" class="formfld unknown" id="filename64" size="20" value="<?=htmlspecialchars($pconfig['filename64']);?>" /><br />
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
			<?php if($mapent['mac'] <> "" or $mapent['ipaddr'] <> ""): ?>
1241
		<tr>
1242
		<td align="center" class="listlr" ondblclick="document.location='services_dhcp_edit.php?if=<?=htmlspecialchars($if);?>&amp;id=<?=$i;?>';">
1243
			<?php if (isset($mapent['arp_table_static_entry'])): ?>
1244
				<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_alert.gif" alt="ARP Table Static Entry" width="17" height="17" border="0" alt="alert" />
1245
			<?php endif; ?>
1246
		</td>
1247
		<td class="listlr" ondblclick="document.location='services_dhcp_edit.php?if=<?=htmlspecialchars($if);?>&amp;id=<?=$i;?>';">
1248
			<?=htmlspecialchars($mapent['mac']);?>
1249
		</td>
1250
		<td class="listr" ondblclick="document.location='services_dhcp_edit.php?if=<?=htmlspecialchars($if);?>&amp;id=<?=$i;?>';">
1251
			<?=htmlspecialchars($mapent['ipaddr']);?>&nbsp;
1252
		</td>
1253
		<td class="listr" ondblclick="document.location='services_dhcp_edit.php?if=<?=htmlspecialchars($if);?>&amp;id=<?=$i;?>';">
1254
			<?=htmlspecialchars($mapent['hostname']);?>&nbsp;
1255
		</td>
1256
		<td class="listbg" ondblclick="document.location='services_dhcp_edit.php?if=<?=htmlspecialchars($if);?>&amp;id=<?=$i;?>';">
1257
			<?=htmlspecialchars($mapent['descr']);?>&nbsp;
1258
		</td>
1259
		<td valign="middle" class="list nowrap">
1260
			<table border="0" cellspacing="0" cellpadding="1" summary="icons">
1261
			<tr>
1262
			<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>
1263
			<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>
1264
			</tr>
1265
			</table>
1266
		</td>
1267
		</tr>
1268
		<?php endif; ?>
1269
		<?php $i++; endforeach; ?>
1270
		<?php endif; ?>
1271
		<tr>
1272
		<td class="list" colspan="5"></td>
1273
		<td class="list">
1274
			<table border="0" cellspacing="0" cellpadding="1" summary="add">
1275
			<tr>
1276
			<td valign="middle" width="17"></td>
1277
			<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>
1278
			</tr>
1279
			</table>
1280
		</td>
1281
		</tr>
1282
		</table>
1283
		<?php endif; ?>
1284
	</div>
1285
</td>
1286
</tr>
1287
</table>
1288
</form>
1289
<script type="text/javascript">
1290
//<![CDATA[
1291
enable_change(false);
1292
//]]>
1293
</script>
1294
<?php include("fend.inc"); ?>
1295
</body>
1296
</html>
(150-150/256)