Project

General

Profile

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

    
6
	Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
7
	All rights reserved.
8

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

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

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

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

    
34
##|+PRIV
35
##|*IDENT=page-services-captiveportal
36
##|*NAME=Services: Captive portal page
37
##|*DESCR=Allow access to the 'Services: Captive portal' page.
38
##|*MATCH=services_captiveportal.php*
39
##|-PRIV
40

    
41
$statusurl = "status_captiveportal.php";
42
$logurl = "diag_logs_auth.php";
43

    
44
require("guiconfig.inc");
45
require("functions.inc");
46
require("filter.inc");
47
require("shaper.inc");
48
require("captiveportal.inc");
49

    
50
$pgtitle = array(gettext("Services"),gettext("Captive portal"));
51

    
52
if (!is_array($config['captiveportal'])) {
53
	$config['captiveportal'] = array();
54
	$config['captiveportal']['page'] = array();
55
	$config['captiveportal']['timeout'] = 60;
56
}
57

    
58
if ($_GET['act'] == "viewhtml") {
59
	echo base64_decode($config['captiveportal']['page']['htmltext']);
60
	exit;
61
} else if ($_GET['act'] == "viewerrhtml") {
62
	echo base64_decode($config['captiveportal']['page']['errtext']);
63
	exit;
64
} else if ($_GET['act'] == "viewlogouthtml") {
65
	echo base64_decode($config['captiveportal']['page']['logouttext']);
66
	exit;
67
}
68

    
69
$pconfig['cinterface'] = $config['captiveportal']['interface'];
70
$pconfig['maxproc'] = $config['captiveportal']['maxproc'];
71
$pconfig['maxprocperip'] = $config['captiveportal']['maxprocperip'];
72
$pconfig['timeout'] = $config['captiveportal']['timeout'];
73
$pconfig['idletimeout'] = $config['captiveportal']['idletimeout'];
74
$pconfig['freelogins_count'] = $config['captiveportal']['freelogins_count'];
75
$pconfig['freelogins_resettimeout'] = $config['captiveportal']['freelogins_resettimeout'];
76
$pconfig['freelogins_updatetimeouts'] = isset($config['captiveportal']['freelogins_updatetimeouts']);
77
$pconfig['enable'] = isset($config['captiveportal']['enable']);
78
$pconfig['auth_method'] = $config['captiveportal']['auth_method'];
79
$pconfig['radacct_enable'] = isset($config['captiveportal']['radacct_enable']);
80
$pconfig['radmac_enable'] = isset($config['captiveportal']['radmac_enable']);
81
$pconfig['radmac_secret'] = $config['captiveportal']['radmac_secret'];
82
$pconfig['reauthenticate'] = isset($config['captiveportal']['reauthenticate']);
83
$pconfig['reauthenticateacct'] = $config['captiveportal']['reauthenticateacct'];
84
$pconfig['httpslogin_enable'] = isset($config['captiveportal']['httpslogin']);
85
$pconfig['httpsname'] = $config['captiveportal']['httpsname'];
86
$pconfig['preauthurl'] = strtolower($config['captiveportal']['preauthurl']);
87
$pconfig['cert'] = base64_decode($config['captiveportal']['certificate']);
88
$pconfig['cacert'] = base64_decode($config['captiveportal']['cacertificate']);
89
$pconfig['key'] = base64_decode($config['captiveportal']['private-key']);
90
$pconfig['logoutwin_enable'] = isset($config['captiveportal']['logoutwin_enable']);
91
$pconfig['peruserbw'] = isset($config['captiveportal']['peruserbw']);
92
$pconfig['bwdefaultdn'] = $config['captiveportal']['bwdefaultdn'];
93
$pconfig['bwdefaultup'] = $config['captiveportal']['bwdefaultup'];
94
$pconfig['nomacfilter'] = isset($config['captiveportal']['nomacfilter']);
95
$pconfig['noconcurrentlogins'] = isset($config['captiveportal']['noconcurrentlogins']);
96
$pconfig['redirurl'] = $config['captiveportal']['redirurl'];
97
$pconfig['radiusip'] = $config['captiveportal']['radiusip'];
98
$pconfig['radiusip2'] = $config['captiveportal']['radiusip2'];
99
$pconfig['radiusport'] = $config['captiveportal']['radiusport'];
100
$pconfig['radiusport2'] = $config['captiveportal']['radiusport2'];
101
$pconfig['radiusacctport'] = $config['captiveportal']['radiusacctport'];
102
$pconfig['radiuskey'] = $config['captiveportal']['radiuskey'];
103
$pconfig['radiuskey2'] = $config['captiveportal']['radiuskey2'];
104
$pconfig['radiusvendor'] = $config['captiveportal']['radiusvendor'];
105
$pconfig['radiussession_timeout'] = isset($config['captiveportal']['radiussession_timeout']);
106
$pconfig['radiussrcip_attribute'] = $config['captiveportal']['radiussrcip_attribute'];
107
$pconfig['passthrumacadd'] = isset($config['captiveportal']['passthrumacadd']);
108
$pconfig['passthrumacaddusername'] = isset($config['captiveportal']['passthrumacaddusername']);
109
$pconfig['radmac_format'] = $config['captiveportal']['radmac_format'];
110

    
111
if ($_POST) {
112

    
113
	unset($input_errors);
114
	$pconfig = $_POST;
115

    
116
	/* input validation */
117
	if ($_POST['enable']) {
118
		$reqdfields = explode(" ", "cinterface");
119
		$reqdfieldsn = array(gettext("Interface"));
120

    
121
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
122

    
123
		/* make sure no interfaces are bridged */
124
		if (is_array($_POST['cinterface']))
125
			foreach ($pconfig['cinterface'] as $cpbrif)
126
				if (link_interface_to_bridge($cpbrif))
127
					$input_errors[] = sprintf(gettext("The captive portal cannot be used on interface %s since it is part of a bridge."), $cpbrif);
128

    
129
		if ($_POST['httpslogin_enable']) {
130
		 	if (!$_POST['cert'] || !$_POST['key']) {
131
				$input_errors[] = gettext("Certificate and key must be specified for HTTPS login.");
132
			} else {
133
				if (!strstr($_POST['cert'], "BEGIN CERTIFICATE") || !strstr($_POST['cert'], "END CERTIFICATE"))
134
					$input_errors[] = gettext("This certificate does not appear to be valid.");
135
				if (!strstr($_POST['cacert'], "BEGIN CERTIFICATE") || !strstr($_POST['cacert'], "END CERTIFICATE"))
136
					$input_errors[] = gettext("This intermmediate certificate does not appear to be valid.");
137
				if (!strstr($_POST['key'], "BEGIN RSA PRIVATE KEY") || !strstr($_POST['key'], "END RSA PRIVATE KEY"))
138
					$input_errors[] = gettext("This key does not appear to be valid.");
139
			}
140

    
141
			if (!$_POST['httpsname'] || !is_domain($_POST['httpsname'])) {
142
				$input_errors[] = gettext("The HTTPS server name must be specified for HTTPS login.");
143
			}
144
		}
145
	}
146

    
147
	if ($_POST['timeout'] && (!is_numeric($_POST['timeout']) || ($_POST['timeout'] < 1))) {
148
		$input_errors[] = gettext("The timeout must be at least 1 minute.");
149
	}
150
	if ($_POST['idletimeout'] && (!is_numeric($_POST['idletimeout']) || ($_POST['idletimeout'] < 1))) {
151
		$input_errors[] = gettext("The idle timeout must be at least 1 minute.");
152
	}
153
	if ($_POST['freelogins_count'] && (!is_numeric($_POST['freelogins_count']))) {
154
		$input_errors[] = gettext("The pass-through credit count must be a number or left blank.");
155
	} else if ($_POST['freelogins_count'] && is_numeric($_POST['freelogins_count']) && ($_POST['freelogins_count'] >= 1)) {
156
		if (empty($_POST['freelogins_resettimeout']) || !is_numeric($_POST['freelogins_resettimeout']) || ($_POST['freelogins_resettimeout'] <= 0)) {
157
			$input_errors[] = gettext("The waiting period to restore pass-through credits must be above 0 hours.");
158
		}
159
	}
160
	if (($_POST['radiusip'] && !is_ipaddr($_POST['radiusip']))) {
161
		$input_errors[] = sprintf(gettext("A valid IP address must be specified. [%s]"), $_POST['radiusip']);
162
	}
163
	if (($_POST['radiusip2'] && !is_ipaddr($_POST['radiusip2']))) {
164
		$input_errors[] = sprintf(gettext("A valid IP address must be specified. [%s]"), $_POST['radiusip2']);
165
	}
166
	if (($_POST['radiusport'] && !is_port($_POST['radiusport']))) {
167
		$input_errors[] = sprintf(gettext("A valid port number must be specified. [%s]"), $_POST['radiusport']);
168
	}
169
	if (($_POST['radiusport2'] && !is_port($_POST['radiusport2']))) {
170
		$input_errors[] = sprintf(gettext("A valid port number must be specified. [%s]"), $_POST['radiusport2']);
171
	}
172
	if (($_POST['radiusacctport'] && !is_port($_POST['radiusacctport']))) {
173
		$input_errors[] = sprintf(gettext("A valid port number must be specified. [%s]"), $_POST['radiusacctport']);
174
	}
175
	if ($_POST['maxproc'] && (!is_numeric($_POST['maxproc']) || ($_POST['maxproc'] < 4) || ($_POST['maxproc'] > 100))) {
176
		$input_errors[] = gettext("The total maximum number of concurrent connections must be between 4 and 100.");
177
	}
178
	$mymaxproc = $_POST['maxproc'] ? $_POST['maxproc'] : 16;
179
	if ($_POST['maxprocperip'] && (!is_numeric($_POST['maxprocperip']) || ($_POST['maxprocperip'] > $mymaxproc))) {
180
		$input_errors[] = gettext("The maximum number of concurrent connections per client IP address may not be larger than the global maximum.");
181
	}
182

    
183
	if (!$input_errors) {
184
		if (is_array($_POST['cinterface']))
185
			$config['captiveportal']['interface'] = implode(",", $_POST['cinterface']);
186
		$config['captiveportal']['maxproc'] = $_POST['maxproc'];
187
		$config['captiveportal']['maxprocperip'] = $_POST['maxprocperip'] ? $_POST['maxprocperip'] : false;
188
		$config['captiveportal']['timeout'] = $_POST['timeout'];
189
		$config['captiveportal']['idletimeout'] = $_POST['idletimeout'];
190
		$config['captiveportal']['freelogins_count'] = $_POST['freelogins_count'];
191
		$config['captiveportal']['freelogins_resettimeout'] = $_POST['freelogins_resettimeout'];
192
		$config['captiveportal']['freelogins_updatetimeouts'] = $_POST['freelogins_updatetimeouts'] ? true : false;
193
		$config['captiveportal']['enable'] = $_POST['enable'] ? true : false;
194
		$config['captiveportal']['auth_method'] = $_POST['auth_method'];
195
		$config['captiveportal']['radacct_enable'] = $_POST['radacct_enable'] ? true : false;
196
		$config['captiveportal']['reauthenticate'] = $_POST['reauthenticate'] ? true : false;
197
		$config['captiveportal']['radmac_enable'] = $_POST['radmac_enable'] ? true : false;
198
		$config['captiveportal']['radmac_secret'] = $_POST['radmac_secret'] ? $_POST['radmac_secret'] : false;
199
		$config['captiveportal']['reauthenticateacct'] = $_POST['reauthenticateacct'];
200
		$config['captiveportal']['httpslogin'] = $_POST['httpslogin_enable'] ? true : false;
201
		$config['captiveportal']['httpsname'] = $_POST['httpsname'];
202
		$config['captiveportal']['preauthurl'] = $_POST['preauthurl'];
203
		$config['captiveportal']['peruserbw'] = $_POST['peruserbw'] ? true : false;
204
		$config['captiveportal']['bwdefaultdn'] = $_POST['bwdefaultdn'];
205
		$config['captiveportal']['bwdefaultup'] = $_POST['bwdefaultup'];
206
		$config['captiveportal']['certificate'] = base64_encode($_POST['cert']);
207
		$config['captiveportal']['cacertificate'] = base64_encode($_POST['cacert']);
208
		$config['captiveportal']['private-key'] = base64_encode($_POST['key']);
209
		$config['captiveportal']['logoutwin_enable'] = $_POST['logoutwin_enable'] ? true : false;
210
		$config['captiveportal']['nomacfilter'] = $_POST['nomacfilter'] ? true : false;
211
		$config['captiveportal']['noconcurrentlogins'] = $_POST['noconcurrentlogins'] ? true : false;
212
		$config['captiveportal']['redirurl'] = $_POST['redirurl'];
213
		$config['captiveportal']['radiusip'] = $_POST['radiusip'];
214
		$config['captiveportal']['radiusip2'] = $_POST['radiusip2'];
215
		$config['captiveportal']['radiusport'] = $_POST['radiusport'];
216
		$config['captiveportal']['radiusport2'] = $_POST['radiusport2'];
217
		$config['captiveportal']['radiusacctport'] = $_POST['radiusacctport'];
218
		$config['captiveportal']['radiuskey'] = $_POST['radiuskey'];
219
		$config['captiveportal']['radiuskey2'] = $_POST['radiuskey2'];
220
		$config['captiveportal']['radiusvendor'] = $_POST['radiusvendor'] ? $_POST['radiusvendor'] : false;
221
		$config['captiveportal']['radiussession_timeout'] = $_POST['radiussession_timeout'] ? true : false;
222
		$config['captiveportal']['radiussrcip_attribute'] = $_POST['radiussrcip_attribute'];
223
		$config['captiveportal']['passthrumacadd'] = $_POST['passthrumacadd'] ? true : false;
224
		$config['captiveportal']['passthrumacaddusername'] = $_POST['passthrumacaddusername'] ? true : false;
225
		$config['captiveportal']['radmac_format'] = $_POST['radmac_format'] ? $_POST['radmac_format'] : false;
226

    
227
		/* file upload? */
228
		if (is_uploaded_file($_FILES['htmlfile']['tmp_name']))
229
			$config['captiveportal']['page']['htmltext'] = base64_encode(file_get_contents($_FILES['htmlfile']['tmp_name']));
230
		if (is_uploaded_file($_FILES['errfile']['tmp_name']))
231
			$config['captiveportal']['page']['errtext'] = base64_encode(file_get_contents($_FILES['errfile']['tmp_name']));
232
		if (is_uploaded_file($_FILES['logoutfile']['tmp_name']))
233
			$config['captiveportal']['page']['logouttext'] = base64_encode(file_get_contents($_FILES['logoutfile']['tmp_name']));
234

    
235
		write_config();
236

    
237
		$retval = 0;
238
		$retval = captiveportal_configure();
239

    
240
		$savemsg = get_std_save_message($retval);
241
		
242
		if (is_array($_POST['cinterface']))
243
			$pconfig['cinterface'] = implode(",", $_POST['cinterface']);
244

    
245
		filter_configure();
246
	}
247
}
248
include("head.inc");
249
?>
250
<?php include("fbegin.inc"); ?>
251
<script language="JavaScript">
252
<!--
253
function enable_change(enable_change) {
254
	var endis, radius_endis;
255
	endis = !(document.iform.enable.checked || enable_change);
256
	radius_endis = !((!endis && document.iform.auth_method[2].checked) || enable_change);
257

    
258
	document.iform.cinterface.disabled = endis;
259
	//document.iform.maxproc.disabled = endis;
260
	document.iform.maxprocperip.disabled = endis;
261
	document.iform.idletimeout.disabled = endis;
262
	document.iform.freelogins_count.disabled = endis;
263
	document.iform.freelogins_resettimeout.disabled = endis;
264
	document.iform.freelogins_updatetimeouts.disabled = endis;
265
	document.iform.timeout.disabled = endis;
266
	document.iform.redirurl.disabled = endis;
267
	document.iform.radiusip.disabled = radius_endis;
268
	document.iform.radiusip2.disabled = radius_endis;
269
	document.iform.radiusport.disabled = radius_endis;
270
	document.iform.radiusport2.disabled = radius_endis;
271
	document.iform.radiuskey.disabled = radius_endis;
272
	document.iform.radiuskey2.disabled = radius_endis;
273
	document.iform.radacct_enable.disabled = radius_endis;
274
	document.iform.peruserbw.disabled = endis;
275
	document.iform.bwdefaultdn.disabled = endis;
276
	document.iform.bwdefaultup.disabled = endis;
277
	document.iform.reauthenticate.disabled = radius_endis;
278
	document.iform.auth_method[0].disabled = endis;
279
	document.iform.auth_method[1].disabled = endis;
280
	document.iform.auth_method[2].disabled = endis;
281
	document.iform.radmac_enable.disabled = radius_endis;
282
	document.iform.httpslogin_enable.disabled = endis;
283
	document.iform.radmac_format.disabled = radius_endis;
284
	document.iform.httpsname.disabled = endis;
285
	document.iform.cert.disabled = endis;
286
	document.iform.key.disabled = endis;
287
	document.iform.logoutwin_enable.disabled = endis;
288
	document.iform.nomacfilter.disabled = endis;
289
	document.iform.noconcurrentlogins.disabled = endis;
290
	document.iform.radiusvendor.disabled = radius_endis;
291
	document.iform.radiussession_timeout.disabled = radius_endis;
292
	document.iform.radiussrcip_attribute.disabled = radius_endis;
293
	document.iform.htmlfile.disabled = endis;
294
	document.iform.errfile.disabled = endis;
295
	document.iform.logoutfile.disabled = endis;
296

    
297
	document.iform.radiusacctport.disabled = (radius_endis || !document.iform.radacct_enable.checked) && !enable_change;
298

    
299
	document.iform.radmac_secret.disabled = (radius_endis || !document.iform.radmac_enable.checked) && !enable_change;
300

    
301
	var reauthenticate_dis = (radius_endis || !document.iform.reauthenticate.checked) && !enable_change;
302
	document.iform.reauthenticateacct[0].disabled = reauthenticate_dis;
303
	document.iform.reauthenticateacct[1].disabled = reauthenticate_dis;
304
	document.iform.reauthenticateacct[2].disabled = reauthenticate_dis;
305
}
306
//-->
307
</script>
308
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
309
<?php if ($input_errors) print_input_errors($input_errors); ?>
310
<?php if ($savemsg) print_info_box($savemsg); ?>
311
<form action="services_captiveportal.php" method="post" enctype="multipart/form-data" name="iform" id="iform">
312
<table width="100%" border="0" cellpadding="0" cellspacing="0">
313
  <tr><td class="tabnavtbl">
314
<?php
315
	$tab_array = array();
316
	$tab_array[] = array(gettext("Captive portal"), true, "services_captiveportal.php");
317
	$tab_array[] = array(gettext("Pass-through MAC"), false, "services_captiveportal_mac.php");
318
	$tab_array[] = array(gettext("Allowed IP addresses"), false, "services_captiveportal_ip.php");
319
	$tab_array[] = array(gettext("Allowed Hostnames"), false, "services_captiveportal_hostname.php");	
320
	$tab_array[] = array(gettext("Vouchers"), false, "services_captiveportal_vouchers.php");
321
	$tab_array[] = array(gettext("File Manager"), false, "services_captiveportal_filemanager.php");
322
	display_top_tabs($tab_array, true);
323
?>    </td></tr>
324
  <tr>
325
  <td class="tabcont">
326
  <table width="100%" border="0" cellpadding="6" cellspacing="0">
327
	<tr>
328
	  <td width="22%" valign="top" class="vtable">&nbsp;</td>
329
	  <td width="78%" class="vtable">
330
		<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
331
		<strong><?=gettext("Enable captive portal"); ?> </strong></td>
332
	</tr>
333
	<tr>
334
	  <td width="22%" valign="top" class="vncellreq"><?=gettext("Interfaces"); ?></td>
335
	  <td width="78%" class="vtable">
336
		<select name="cinterface[]" multiple="true" size="<?php echo count($config['interfaces']); ?>" class="formselect" id="cinterface">
337
		  <?php 
338
		  $interfaces = get_configured_interface_with_descr();
339
		  foreach ($interfaces as $iface => $ifacename): ?>
340
		  <option value="<?=$iface;?>" <?php if (stristr($pconfig['cinterface'], $iface)) echo "selected"; ?>>
341
		  <?=htmlspecialchars($ifacename);?>
342
		  </option>
343
		  <?php endforeach; ?>
344
		</select> <br>
345
		<span class="vexpl"><?=gettext("Select the interface(s) to enable for captive portal."); ?></span></td>
346
	</tr>
347
	<tr>
348
	  <td valign="top" class="vncell"><?=gettext("Maximum concurrent connections"); ?></td>
349
	  <td class="vtable">
350
		<table cellpadding="0" cellspacing="0">
351
                 <tr>
352
           			<td><input name="maxprocperip" type="text" class="formfld unknown" id="maxprocperip" size="5" 
353
value="<?=htmlspecialchars($pconfig['maxprocperip']);?>"> <?=gettext("per client IP address (0 = no limit)"); ?></td>
354
                 </tr>
355
               </table>
356
<?=gettext("This setting limits the number of concurrent connections to the captive portal HTTP(S) server. This does not set how many users can be logged in " .
357
"to the captive portal, but rather how many users can load the portal page or authenticate at the same time! " .
358
"Default is 4 connections per client IP address, with a total maximum of 16 connections."); ?></td>
359
	</tr>
360
	<tr>
361
	  <td valign="top" class="vncell"><?=gettext("Idle timeout"); ?></td>
362
	  <td class="vtable">
363
		<input name="idletimeout" type="text" class="formfld unknown" id="idletimeout" size="6" value="<?=htmlspecialchars($pconfig['idletimeout']);?>">
364
<?=gettext("minutes"); ?><br>
365
<?=gettext("Clients will be disconnected after this amount of inactivity. They may log in again immediately, though. Leave this field blank for no idle timeout."); ?></td>
366
	</tr>
367
	<tr>
368
	  <td width="22%" valign="top" class="vncell"><?=gettext("Hard timeout"); ?></td>
369
	  <td width="78%" class="vtable">
370
		<input name="timeout" type="text" class="formfld unknown" id="timeout" size="6" value="<?=htmlspecialchars($pconfig['timeout']);?>">
371
		<?=gettext("minutes"); ?><br>
372
	  <?=gettext("Clients will be disconnected after this amount of time, regardless of activity. They may log in again immediately, though. Leave this field blank for no hard timeout (not recommended unless an idle timeout is set)."); ?></td>
373
	</tr>
374
	<tr>
375
	  <td width="22%" valign="top" class="vncell"><?=gettext("Pass-through credits allowed per MAC address"); ?></td>
376
	  <td width="78%" class="vtable">
377
		<input name="freelogins_count" type="text" class="formfld unknown" id="freelogins_count" size="6" value="<?=htmlspecialchars($pconfig['freelogins_count']);?>">
378
		<?=gettext("per client MAC address (0 or blank = none)"); ?><br>
379
		<?=gettext("This setting allows passing through the captive portal without authentication a limited number of times per MAC address. Once used up, the client can only log in with valid credentials until the waiting period specified below has expired. Recommended to set a hard timeout and/or idle timeout when using this for it to be effective."); ?></td>
380
	</tr>
381
	<tr>
382
	  <td width="22%" valign="top" class="vncell"><?=gettext("Waiting period to restore pass-through credits"); ?></td>
383
	  <td width="78%" class="vtable">
384
		<input name="freelogins_resettimeout" type="text" class="formfld unknown" id="freelogins_resettimeout" size="6" value="<?=htmlspecialchars($pconfig['freelogins_resettimeout']);?>">
385
		<?=gettext("hours"); ?><br>
386
		<?=gettext("Clients will have their available pass-through credits restored to the original count after this amount of time since using the first one. This must be above 0 hours if pass-through credits are enabled."); ?></td>
387
	</tr>
388
	<tr>
389
	  <td width="22%" valign="top" class="vncell"><?=gettext("Reset waiting period on attempted access"); ?></td>
390
	  <td width="78%" class="vtable">
391
		<input name="freelogins_updatetimeouts" type="checkbox" class="formfld" id="freelogins_updatetimeouts" value="yes" <?php if($pconfig['freelogins_updatetimeouts']) echo "checked"; ?>>
392
		<strong><?=gettext("Enable waiting period reset on attempted access"); ?></strong><br>
393
		<?=gettext("If enabled, the waiting period is reset to the original duration if access is attempted when all pass-through credits have already been exhausted."); ?></td>
394
	</tr>
395
	<tr>
396
	  <td width="22%" valign="top" class="vncell"><?=gettext("Logout popup window"); ?></td>
397
	  <td width="78%" class="vtable">
398
		<input name="logoutwin_enable" type="checkbox" class="formfld" id="logoutwin_enable" value="yes" <?php if($pconfig['logoutwin_enable']) echo "checked"; ?>>
399
		<strong><?=gettext("Enable logout popup window"); ?></strong><br>
400
	  <?=gettext("If enabled, a popup window will appear when clients are allowed through the captive portal. This allows clients to explicitly disconnect themselves before the idle or hard timeout occurs."); ?></td>
401
	</tr>
402
	<tr>
403
      <td valign="top" class="vncell"><?=gettext("Pre-authentication redirect URL"); ?> </td>
404
      <td class="vtable">
405
        <input name="preauthurl" type="text" class="formfld url" id="preauthurl" size="60" value="<?=htmlspecialchars($pconfig['preauthurl']);?>"><br>
406
		<?php printf(gettext("Use this field to set \$PORTAL_REDIRURL\$ variable which can be accessed using your custom captive portal index.php page or error pages."));?> 
407
	  </td>
408
	</tr>
409
	<tr>
410
	  <td valign="top" class="vncell"><?=gettext("After authentication Redirection URL"); ?></td>
411
	  <td class="vtable">
412
		<input name="redirurl" type="text" class="formfld url" id="redirurl" size="60" value="<?=htmlspecialchars($pconfig['redirurl']);?>">
413
		<br>
414
<?=gettext("If you provide a URL here, clients will be redirected to that URL instead of the one they initially tried " .
415
"to access after they've authenticated."); ?></td>
416
	</tr>
417
	<tr>
418
      <td valign="top" class="vncell"><?=gettext("Concurrent user logins"); ?></td>
419
      <td class="vtable">
420
	<input name="noconcurrentlogins" type="checkbox" class="formfld" id="noconcurrentlogins" value="yes" <?php if ($pconfig['noconcurrentlogins']) echo "checked"; ?>>
421
	<strong><?=gettext("Disable concurrent logins"); ?></strong><br>
422
	<?=gettext("If this option is set, only the most recent login per username will be active. Subsequent logins will cause machines previously logged in with the same username to be disconnected."); ?></td>
423
	</tr>
424
	<tr>
425
      <td valign="top" class="vncell"><?=gettext("MAC filtering"); ?> </td>
426
      <td class="vtable">
427
        <input name="nomacfilter" type="checkbox" class="formfld" id="nomacfilter" value="yes" <?php if ($pconfig['nomacfilter']) echo "checked"; ?>>
428
        <strong><?=gettext("Disable MAC filtering"); ?></strong><br>
429
    <?=gettext("If this option is set, no attempts will be made to ensure that the MAC address of clients stays the same while they're logged in." .
430
    "This is required when the MAC address of the client cannot be determined (usually because there are routers between"); ?> <?php echo $g['product_name'] ?> <?=gettext("and the clients)."); ?>
431
    <?=gettext("If this is enabled, RADIUS MAC authentication cannot be used."); ?></td>
432
	</tr>
433
	<tr>
434
      <td valign="top" class="vncell"><?=gettext("Pass-through MAC Auto Entry"); ?></td>
435
      <td class="vtable">
436
        <input name="passthrumacadd" type="checkbox" class="formfld" id="passthrumacadd" value="yes" <?php if ($pconfig['passthrumacadd']) echo "checked"; ?>>
437
        <strong><?=gettext("Enable Pass-through MAC automatic additions"); ?></strong><br>
438
    <?=gettext("If this option is set, a MAC passthrough entry is automatically added after the user has successfully authenticated. Users of that MAC address will never have to authenticate again."); ?> 
439
    <?=gettext("To remove the passthrough MAC entry you either have to log in and remove it manually from the"); ?> <a href="services_captiveportal_mac.php"><?=gettext("Pass-through MAC tab"); ?></a> <?=gettext("or send a POST from another system to remove it."); ?>
440
    <?=gettext("If this is enabled, RADIUS MAC authentication cannot be used. Also, the logout window will not be shown."); ?>
441
	<br/><br/>
442
        <input name="passthrumacaddusername" type="checkbox" class="formfld" id="passthrumacaddusername" value="yes" <?php if ($pconfig['passthrumacaddusername']) echo "checked"; ?>>
443
        <strong><?=gettext("Enable Pass-through MAC automatic addition with username"); ?></strong><br>
444
    <?=gettext("If this option is set, with the automatically MAC passthrough entry created the username, used during authentication, will be saved."); ?>
445
    <?=gettext("To remove the passthrough MAC entry you either have to log in and remove it manually from the"); ?> <a href="services_captiveportal_mac.php"><?=gettext("Pass-through MAC tab"); ?></a> <?=gettext("or send a POST from another system to remove it."); ?>
446
	</td>
447
	</tr>
448
	<tr>
449
      <td valign="top" class="vncell"><?=gettext("Per-user bandwidth restriction"); ?></td>
450
      <td class="vtable">
451
        <input name="peruserbw" type="checkbox" class="formfld" id="peruserbw" value="yes" <?php if ($pconfig['peruserbw']) echo "checked"; ?>>
452
        <strong><?=gettext("Enable per-user bandwidth restriction"); ?></strong><br><br>
453
        <table cellpadding="0" cellspacing="0">
454
        <tr>
455
        <td><?=gettext("Default download"); ?></td>
456
        <td><input type="text" class="formfld unknown" name="bwdefaultdn" id="bwdefaultdn" size="10" value="<?=htmlspecialchars($pconfig['bwdefaultdn']);?>"> <?=gettext("Kbit/s"); ?></td>
457
        </tr>
458
        <tr>
459
        <td><?=gettext("Default upload"); ?></td>
460
        <td><input type="text" class="formfld unknown" name="bwdefaultup" id="bwdefaultup" size="10" value="<?=htmlspecialchars($pconfig['bwdefaultup']);?>"> <?=gettext("Kbit/s"); ?></td>
461
        </tr></table>
462
        <br>
463
        <?=gettext("If this option is set, the captive portal will restrict each user who logs in to the specified default bandwidth. RADIUS can override the default settings. Leave empty or set to 0 for no limit."); ?> </td>
464
	</tr>
465
	<tr>
466
	  <td width="22%" valign="top" class="vncell"><?=gettext("Authentication"); ?></td>
467
	  <td width="78%" class="vtable">
468
		<table cellpadding="0" cellspacing="0">
469
		<tr>
470
		  <td colspan="2"><input name="auth_method" type="radio" id="auth_method" value="none" onClick="enable_change(false)" <?php if($pconfig['auth_method']!="local" && $pconfig['auth_method']!="radius") echo "checked"; ?>>
471
  <?=gettext("No Authentication"); ?></td>
472
		  </tr>
473
		<tr>
474
		  <td colspan="2"><input name="auth_method" type="radio" id="auth_method" value="local" onClick="enable_change(false)" <?php if($pconfig['auth_method']=="local") echo "checked"; ?>>
475
  <?=gettext("Local"); ?> <a href="system_usermanager.php"><?=gettext("User Manager"); ?></a></td>
476
		  </tr>
477
		<tr>
478
		  <td colspan="2"><input name="auth_method" type="radio" id="auth_method" value="radius" onClick="enable_change(false)" <?php if($pconfig['auth_method']=="radius") echo "checked"; ?>>
479
  <?=gettext("RADIUS Authentication"); ?></td>
480
		  </tr><tr>
481
		  <td>&nbsp;</td>
482
		  <td>&nbsp;</td>
483
		  </tr>
484
		</table>
485
		<table width="100%" border="0" cellpadding="6" cellspacing="0">
486
        	<tr>
487
            	<td colspan="2" valign="top" class="optsect_t2"><?=gettext("Primary RADIUS server"); ?></td>
488
			</tr>
489
			<tr>
490
				<td class="vncell" valign="top"><?=gettext("IP address"); ?></td>
491
				<td class="vtable"><input name="radiusip" type="text" class="formfld unknown" id="radiusip" size="20" value="<?=htmlspecialchars($pconfig['radiusip']);?>"><br>
492
				<?=gettext("Enter the IP address of the RADIUS server which users of the captive portal have to authenticate against."); ?></td>
493
			</tr>
494
			<tr>
495
				<td class="vncell" valign="top"><?=gettext("Port"); ?></td>
496
				<td class="vtable"><input name="radiusport" type="text" class="formfld unknown" id="radiusport" size="5" value="<?=htmlspecialchars($pconfig['radiusport']);?>"><br>
497
				 <?=gettext("Leave this field blank to use the default port (1812)."); ?></td>
498
			</tr>
499
			<tr>
500
				<td class="vncell" valign="top"><?=gettext("Shared secret"); ?>&nbsp;&nbsp;</td>
501
				<td class="vtable"><input name="radiuskey" type="text" class="formfld unknown" id="radiuskey" size="16" value="<?=htmlspecialchars($pconfig['radiuskey']);?>"><br>
502
				<?=gettext("Leave this field blank to not use a RADIUS shared secret (not recommended)."); ?></td>
503
			</tr>
504
			<tr>
505
			  <td colspan="2" class="list" height="12"></td>
506
			</tr>
507
			<tr>
508
				<td colspan="2" valign="top" class="optsect_t2"><?=gettext("Secondary RADIUS server"); ?></td>
509
			</tr>
510
			<tr>
511
				<td class="vncell" valign="top"><?=gettext("IP address"); ?></td>
512
				<td class="vtable"><input name="radiusip2" type="text" class="formfld unknown" id="radiusip2" size="20" value="<?=htmlspecialchars($pconfig['radiusip2']);?>"><br>
513
				<?=gettext("If you have a second RADIUS server, you can activate it by entering its IP address here."); ?></td>
514
			</tr>
515
			<tr>
516
				<td class="vncell" valign="top"><?=gettext("Port"); ?></td>
517
				<td class="vtable"><input name="radiusport2" type="text" class="formfld unknown" id="radiusport2" size="5" value="<?=htmlspecialchars($pconfig['radiusport2']);?>"></td>
518
			</tr>
519
			<tr>
520
				<td class="vncell" valign="top"><?=gettext("Shared secret"); ?>&nbsp;&nbsp;</td>
521
				<td class="vtable"><input name="radiuskey2" type="text" class="formfld unknown" id="radiuskey2" size="16" 
522
value="<?=htmlspecialchars($pconfig['radiuskey2']);?>"></td>
523
			</tr>
524
			<tr>
525
			  <td colspan="2" class="list" height="12"></td>
526
			</tr>
527
			<tr>
528
				<td colspan="2" valign="top" class="optsect_t2"><?=gettext("Accounting"); ?></td>
529
			</tr>
530
			<tr>
531
				<td class="vncell">&nbsp;</td>
532
				<td class="vtable"><input name="radacct_enable" type="checkbox" id="radacct_enable" value="yes" onClick="enable_change(false)" <?php if($pconfig['radacct_enable']) echo "checked"; ?>>
533
				<strong><?=gettext("send RADIUS accounting packets"); ?></strong><br>
534
				<?=gettext("If this is enabled, RADIUS accounting packets will be sent to the primary RADIUS server."); ?></td>
535
			</tr>
536
			<tr>
537
			  <td class="vncell" valign="top"><?=gettext("Accounting port"); ?></td>
538
			  <td class="vtable"><input name="radiusacctport" type="text" class="formfld unknown" id="radiusacctport" size="5" value="<?=htmlspecialchars($pconfig['radiusacctport']);?>"><br>
539
			  <?=gettext("Leave blank to use the default port (1813)."); ?></td>
540
			  </tr>
541
			<tr>
542
			  <td colspan="2" class="list" height="12"></td>
543
			</tr>
544
			<tr>
545
				<td colspan="2" valign="top" class="optsect_t2"><?=gettext("Reauthentication"); ?></td>
546
			</tr>
547
			<tr>
548
				<td class="vncell">&nbsp;</td>
549
				<td class="vtable"><input name="reauthenticate" type="checkbox" id="reauthenticate" value="yes" onClick="enable_change(false)" <?php if($pconfig['reauthenticate']) echo "checked"; ?>>
550
			  <strong><?=gettext("Reauthenticate connected users every minute"); ?></strong><br>
551
			  <?=gettext("If reauthentication is enabled, Access-Requests will be sent to the RADIUS server for each user that is " .
552
			  "logged in every minute. If an Access-Reject is received for a user, that user is disconnected from the captive portal immediately."); ?></td>
553
			</tr>
554
			<tr>
555
			  <td class="vncell" valign="top"><?=gettext("Accounting updates"); ?></td>
556
			  <td class="vtable">
557
			  <input name="reauthenticateacct" type="radio" value="" <?php if(!$pconfig['reauthenticateacct']) echo "checked"; ?>> <?=gettext("no accounting updates"); ?><br>
558
			  <input name="reauthenticateacct" type="radio" value="stopstart" <?php if($pconfig['reauthenticateacct'] == "stopstart") echo "checked"; ?>> <?=gettext("stop/start accounting"); ?><br>
559
			  <input name="reauthenticateacct" type="radio" value="interimupdate" <?php if($pconfig['reauthenticateacct'] == "interimupdate") echo "checked"; ?>> <?=gettext("interim update"); ?>
560
			  </td>
561
			</tr>
562
			<tr>
563
			  <td colspan="2" class="list" height="12"></td>
564
			</tr>
565
			<tr>
566
				<td colspan="2" valign="top" class="optsect_t2"><?=gettext("RADIUS MAC authentication"); ?></td>
567
			</tr>
568
			<tr>
569
				<td class="vncell">&nbsp;</td>
570
				<td class="vtable">
571
				<input name="radmac_enable" type="checkbox" id="radmac_enable" value="yes" onClick="enable_change(false)" <?php if ($pconfig['radmac_enable']) echo "checked"; ?>><strong><?=gettext("Enable RADIUS MAC authentication"); ?></strong><br>
572
				<?=gettext("If this option is enabled, the captive portal will try to authenticate users by sending their MAC address as the username and the password " .
573
				"entered below to the RADIUS server."); ?></td>
574
			</tr>
575
			<tr>
576
				<td class="vncell"><?=gettext("Shared secret"); ?></td>
577
				<td class="vtable"><input name="radmac_secret" type="text" class="formfld unknown" id="radmac_secret" size="16" value="<?=htmlspecialchars($pconfig['radmac_secret']);?>"></td>
578
			</tr>
579
			<tr>
580
			  <td colspan="2" class="list" height="12"></td>
581
			</tr>
582
			<tr>
583
				<td colspan="2" valign="top" class="optsect_t2"><?=gettext("RADIUS options"); ?></td>
584
			</tr>
585

    
586
			<tr>
587
				<td class="vncell" valign="top"><?=gettext("RADIUS NAS IP attribute"); ?></td>
588
				<td>
589
				<select name="radiussrcip_attribute" id="radiussrcip_attribute">
590
				<?php $iflist = get_configured_interface_with_descr();
591
					foreach ($iflist as $ifdesc => $ifdescr) {
592
						$ipaddr = get_interface_ip($ifdesc);
593
						if (is_ipaddr($ipaddr)) {
594
							$selected = "";
595
							if ($ipaddr == $pconfig['radiussrcip_attribute'])
596
								$ifdesc = "selected";
597
							echo "<option value='{$ifdesc}' {$selected}>{$ifdescr} - {$ipaddr}</option>\n";
598
						}
599
					}
600
					if (is_array($config['virtualip']['vip'])) {
601
                				foreach ($config['virtualip']['vip'] as $sn) {
602
                        				if ($sn['mode'] == "proxyarp" && $sn['type'] == "network") {
603
                                				$start = ip2long32(gen_subnet($sn['subnet'], $sn['subnet_bits']));
604
                                				$end = ip2long32(gen_subnet_max($sn['subnet'], $sn['subnet_bits']));
605
                                				$len = $end - $start;
606

    
607
                                				for ($i = 0; $i <= $len; $i++) {
608
                                        				$snip = long2ip32($start+$i);
609
                                					echo "<option value='{$snip}' {$selected}>" . htmlspecialchars("{$sn['descr']} - {$snip}") . "></option>\n";
610
								}
611
							} else
612
                                				echo "<option value='{$sn['subnet']}' {$selected}>" . htmlspecialchars("{$sn['descr']} - {$sn['subnet']}") . "></option>\n";
613
						}
614
					}
615
				?>
616
				</select><br/>
617
				<?=gettext("Choose the IP to use for calling station attribute."); ?>
618
				</td>
619
			</tr>
620

    
621
			<tr>
622
				<td class="vncell" valign="top"><?=gettext("Session-Timeout"); ?></td>
623
				<td class="vtable"><input name="radiussession_timeout" type="checkbox" id="radiussession_timeout" value="yes" <?php if ($pconfig['radiussession_timeout']) echo "checked"; ?>><strong><?=gettext("Use RADIUS Session-Timeout attributes"); ?></strong><br>
624
				<?=gettext("When this is enabled, clients will be disconnected after the amount of time retrieved from the RADIUS Session-Timeout attribute."); ?></td>
625
			</tr>
626

    
627
			<tr>
628
				<td class="vncell" valign="top"><?=gettext("Type"); ?></td>
629
				<td class="vtable"><select name="radiusvendor" id="radiusvendor">
630
				<option><?=gettext("default"); ?></option>
631
				<?php
632
				$radiusvendors = array("cisco");
633
				foreach ($radiusvendors as $radiusvendor){
634
					if ($pconfig['radiusvendor'] == $radiusvendor)
635
						echo "<option selected value=\"$radiusvendor\">$radiusvendor</option>\n";
636
					else
637
						echo "<option value=\"$radiusvendor\">$radiusvendor</option>\n";
638
				}
639
				?></select><br>
640
				<?php printf(gettext("If RADIUS type is set to Cisco, in Access-Requests the value of Calling-Station-Id will be set to the client's IP address and " .
641
				"the Called-Station-Id to the client's MAC address. Default behavior is Calling-Station-Id = client's MAC address and Called-Station-Id = %s's WAN IP address."),
642
					$g['product_name']);?></td>
643
			</tr>
644
		</table>
645
	</tr>
646
    <tr>
647
        <td class="vncell" valign="top"><?=gettext("MAC address format"); ?></td>
648
        <td class="vtable">
649
        <select name="radmac_format" id="radmac_format">
650
        <option><?=gettext("default"); ?></option>
651
        <?php
652
        $macformats = array(gettext("singledash"),gettext("ietf"),gettext("cisco"),gettext("unformatted"));
653
        foreach ($macformats as $macformat) {
654
            if ($pconfig['radmac_format'] == $macformat)
655
                echo "<option selected value=\"$macformat\">$macformat</option>\n";
656
            else
657
                echo "<option value=\"$macformat\">$macformat</option>\n";
658
        }
659
        ?>
660
        </select></br>
661
        <?=gettext("This option changes the MAC address format used in the whole RADIUS system. Change this if you also"); ?>
662
        <?=gettext("need to change the username format for RADIUS MAC authentication."); ?><br>
663
        <?=gettext("default:"); ?> 00:11:22:33:44:55<br>
664
        <?=gettext("singledash:"); ?> 001122-334455<br>
665
        <?=gettext("ietf:"); ?> 00-11-22-33-44-55<br>
666
        <?=gettext("cisco:"); ?> 0011.2233.4455<br>
667
        <?=gettext("unformatted:"); ?> 001122334455
668
    </tr>
669
	<tr>
670
      <td valign="top" class="vncell"><?=gettext("HTTPS login"); ?></td>
671
      <td class="vtable">
672
        <input name="httpslogin_enable" type="checkbox" class="formfld" id="httpslogin_enable" value="yes" <?php if($pconfig['httpslogin_enable']) echo "checked"; ?>>
673
        <strong><?=gettext("Enable HTTPS login"); ?></strong><br>
674
    <?=gettext("If enabled, the username and password will be transmitted over an HTTPS connection to protect against eavesdroppers. A server name, certificate and matching private key must also be specified below."); ?></td>
675
	  </tr>
676
	<tr>
677
      <td valign="top" class="vncell"><?=gettext("HTTPS server name"); ?> </td>
678
      <td class="vtable">
679
        <input name="httpsname" type="text" class="formfld unknown" id="httpsname" size="30" value="<?=htmlspecialchars($pconfig['httpsname']);?>"><br>
680
	<?php printf(gettext("This name will be used in the form action for the HTTPS POST and should match the Common Name (CN) in your certificate (otherwise, the client browser will most likely display a security warning). Make sure captive portal clients can resolve this name in DNS and verify on the client that the IP resolves to the correct interface IP on %s."), $g['product_name']);?> </td>
681
	  </tr>
682
	<tr>
683
      <td valign="top" class="vncell"><?=gettext("HTTPS certificate"); ?></td>
684
      <td class="vtable">
685
        <textarea name="cert" cols="65" rows="7" id="cert" class="formpre"><?=htmlspecialchars($pconfig['cert']);?></textarea>
686
        <br>
687
    <?=gettext("Paste a signed certificate in X.509 PEM format here."); ?></td>
688
	  </tr>
689
	<tr>
690
      <td valign="top" class="vncell"><?=gettext("HTTPS private key"); ?></td>
691
      <td class="vtable">
692
        <textarea name="key" cols="65" rows="7" id="key" class="formpre"><?=htmlspecialchars($pconfig['key']);?></textarea>
693
        <br>
694
    <?=gettext("Paste an RSA private key in PEM format here."); ?></td>
695
	  </tr>
696
        <tr>
697
      <td valign="top" class="vncell"><?=gettext("HTTPS intermediate certificate"); ?></td>
698
      <td class="vtable">
699
        <textarea name="cacert" cols="65" rows="7" id="cacert" class="formpre"><?=htmlspecialchars($pconfig['cacert']);?></textarea>
700
        <br>
701
    <?=gettext("Paste a certificate in X.509 PEM format here."); ?></td>
702
          </tr>
703
	<tr>
704
	  <td width="22%" valign="top" class="vncellreq"><?=gettext("Portal page contents"); ?></td>
705
	  <td width="78%" class="vtable">
706
		<?=$mandfldhtml;?><input type="file" name="htmlfile" class="formfld file" id="htmlfile"><br>
707
		<?php
708
			list($host) = explode(":", $_SERVER['HTTP_HOST']);
709
			if(isset($config['captiveportal']['httpslogin'])) {
710
				$href = "https://$host:8001";
711
			} else {
712
				$href = "http://$host:8000";
713
			}
714
		?>
715
		<?php if ($config['captiveportal']['page']['htmltext']): ?>
716
		<a href="<?=$href?>" target="_new"><?=gettext("View current page"); ?></a>
717
		  <br>
718
		  <br>
719
		<?php endif; ?>
720
			<?php
721
				printf(
722
					gettext('Upload an HTML/PHP file for the portal page here (leave blank to keep the current one). ' .
723
							'Make sure to include a form (POST to %1$s) with a submit button (%2$s) and a hidden field with %3$s and %4$s. ' .
724
							'Include the %5$s and %6$s and/or %7$s input fields if authentication is enabled, otherwise it will always fail.'),
725
					"&quot;{$PORTAL_ACTION}&quot;",
726
					"name=&quot;accept&quot;",
727
					"name=&quot;redirurl&quot;",
728
					"value=&quot;{$PORTAL_REDIRURL}&quot;",
729
					"&quot;auth_user&quot;",
730
					"&quot;auth_pass&quot;",
731
					"&quot;auth_voucher&quot;");
732
			?>
733
			<?=gettext("Example code for the form:"); ?><br>
734
		  <br>
735
		  <tt>&lt;form method=&quot;post&quot; action=&quot;$PORTAL_ACTION$&quot;&gt;<br>
736
		  &nbsp;&nbsp;&nbsp;&lt;input name=&quot;auth_user&quot; type=&quot;text&quot;&gt;<br>
737
		  &nbsp;&nbsp;&nbsp;&lt;input name=&quot;auth_pass&quot; type=&quot;password&quot;&gt;<br>
738
		  &nbsp;&nbsp;&nbsp;&lt;input name=&quot;auth_voucher&quot; type=&quot;text&quot;&gt;<br>
739
		  &nbsp;&nbsp;&nbsp;&lt;input name=&quot;redirurl&quot; type=&quot;hidden&quot; value=&quot;$PORTAL_REDIRURL$&quot;&gt;<br>
740
&nbsp;&nbsp;&nbsp;&lt;input name=&quot;accept&quot; type=&quot;submit&quot; value=&quot;Continue&quot;&gt;<br>
741
		  &lt;/form&gt;</tt></td>
742
	</tr>
743
	<tr>
744
	  <td width="22%" valign="top" class="vncell"><?=gettext("Authentication"); ?><br>
745
		<?=gettext("error page"); ?><br>
746
		<?=gettext("contents"); ?></td>
747
	  <td class="vtable">
748
		<input name="errfile" type="file" class="formfld file" id="errfile"><br>
749
		<?php if ($config['captiveportal']['page']['errtext']): ?>
750
		<a href="?act=viewerrhtml" target="_blank"><?=gettext("View current page"); ?></a>
751
		  <br>
752
		  <br>
753
		<?php endif; ?>
754
<?=gettext("The contents of the HTML/PHP file that you upload here are displayed when an authentication error occurs. " .
755
"You may include"); ?> &quot;$PORTAL_MESSAGE$&quot;, <?=gettext("which will be replaced by the error or reply messages from the RADIUS server, if any."); ?></td>
756
	</tr>
757
	<tr>
758
	  <td width="22%" valign="top" class="vncell"><?=gettext("Logout"); ?><br>
759
		<?=gettext("page"); ?><br>
760
		<?=gettext("contents"); ?></td>
761
	  <td class="vtable">
762
		<input name="logoutfile" type="file" class="formfld file" id="logoutfile"><br>
763
		<?php if ($config['captiveportal']['page']['logouttext']): ?>
764
		<a href="?act=viewlogouthtml" target="_blank"><?=gettext("View current page"); ?></a>
765
		  <br>
766
		  <br>
767
		<?php endif; ?>
768
<?=gettext("The contents of the HTML/PHP file that you upload here are displayed on authentication success when the logout popup is enabled."); ?></td>
769
	</tr>
770
	<tr>
771
	  <td width="22%" valign="top">&nbsp;</td>
772
	  <td width="78%">
773
		<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" onClick="enable_change(true)">
774
	  </td>
775
	</tr>
776
	<tr>
777
	  <td width="22%" valign="top">&nbsp;</td>
778
	  <td width="78%"><span class="vexpl"><span class="red"><strong><?=gettext("Note:"); ?><br>
779
		</strong></span><?=gettext("Changing any settings on this page will disconnect all clients! Don't forget to enable the DHCP server on your captive portal interface! Make sure that the default/maximum DHCP lease time is higher than the timeout entered on this page. Also, the DNS forwarder needs to be enabled for DNS lookups by unauthenticated clients to work."); ?> </span></td>
780
	</tr>
781
  </table>
782
  </td>
783
  </tr>
784
  </table>
785
</form>
786
<script language="JavaScript">
787
<!--
788
enable_change(false);
789
//-->
790
</script>
791
<?php include("fend.inc"); ?>
792
</body>
793
</html>
794

    
(128-128/225)