Project

General

Profile

Download (22.3 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/usr/local/bin/php
2
<?php
3
/* $Id$ */
4
/*
5
	services_captiveportal.php
6
	part of m0n0wall (http://m0n0.ch/wall)
7

    
8
	Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
9
	All rights reserved.
10

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

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

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

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

    
33
$pgtitle = array("Services", "Captive portal");
34
require("guiconfig.inc");
35

    
36
if (!is_array($config['captiveportal'])) {
37
	$config['captiveportal'] = array();
38
	$config['captiveportal']['page'] = array();
39
	$config['captiveportal']['timeout'] = 60;
40
}
41

    
42
if ($_GET['act'] == "viewhtml") {
43
	echo base64_decode($config['captiveportal']['page']['htmltext']);
44
	exit;
45
} else if ($_GET['act'] == "viewerrhtml") {
46
	echo base64_decode($config['captiveportal']['page']['errtext']);
47
	exit;
48
}
49

    
50
$pconfig['cinterface'] = $config['captiveportal']['interface'];
51
$pconfig['timeout'] = $config['captiveportal']['timeout'];
52
$pconfig['idletimeout'] = $config['captiveportal']['idletimeout'];
53
$pconfig['enable'] = isset($config['captiveportal']['enable']);
54
$pconfig['auth_method'] = $config['captiveportal']['auth_method'];
55
$pconfig['radacct_enable'] = isset($config['captiveportal']['radacct_enable']);
56
$pconfig['httpslogin_enable'] = isset($config['captiveportal']['httpslogin']);
57
$pconfig['httpsname'] = $config['captiveportal']['httpsname'];
58
$pconfig['cert'] = base64_decode($config['captiveportal']['certificate']);
59
$pconfig['key'] = base64_decode($config['captiveportal']['private-key']);
60
$pconfig['logoutwin_enable'] = isset($config['captiveportal']['logoutwin_enable']);
61
$pconfig['nomacfilter'] = isset($config['captiveportal']['nomacfilter']);
62
$pconfig['peruserbw'] = isset($config['captiveportal']['peruserbw']);
63
$pconfig['bwauthmacup'] = $config['captiveportal']['bwauthmacup'];
64
$pconfig['bwauthmacdn'] = $config['captiveportal']['bwauthmacdn'];
65
$pconfig['bwauthipup'] = $config['captiveportal']['bwauthipup'];
66
$pconfig['bwauthipdn'] = $config['captiveportal']['bwauthipdn'];
67
$pconfig['bwdefaultup'] = $config['captiveportal']['bwdefaultup'];
68
$pconfig['bwdefaultdn'] = $config['captiveportal']['bwdefaultdn'];
69
$pconfig['redirurl'] = $config['captiveportal']['redirurl'];
70
$pconfig['radiusip'] = $config['captiveportal']['radiusip'];
71
$pconfig['radiusport'] = $config['captiveportal']['radiusport'];
72
$pconfig['radiusacctport'] = $config['captiveportal']['radiusacctport'];
73
$pconfig['radiuskey'] = $config['captiveportal']['radiuskey'];
74

    
75
if ($_POST) {
76

    
77
	unset($input_errors);
78
	$pconfig = $_POST;
79

    
80
	/* input validation */
81
	if ($_POST['enable']) {
82
		$config['captiveportal']['enable'] = $_POST['enable'] ? true : false;
83

    
84
		$reqdfields = explode(" ", "cinterface");
85
		$reqdfieldsn = explode(",", "Interface");
86

    
87
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
88

    
89
		/* make sure no interfaces are bridged */
90
		for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
91
			$coptif = &$config['interfaces']['opt' . $i];
92
			if (isset($coptif['enable']) && $coptif['bridge']) {
93
				$input_errors[] = "The captive portal cannot be used when one or more interfaces are bridged.";
94
				break;
95
			}
96
		}
97

    
98
		if ($_POST['httpslogin_enable']) {
99
		 	if (!$_POST['cert'] || !$_POST['key']) {
100
				$input_errors[] = "Certificate and key must be specified for HTTPS login.";
101
			} else {
102
				if (!strstr($_POST['cert'], "BEGIN CERTIFICATE") || !strstr($_POST['cert'], "END CERTIFICATE"))
103
					$input_errors[] = "This certificate does not appear to be valid.";
104
				if (!strstr($_POST['key'], "BEGIN RSA PRIVATE KEY") || !strstr($_POST['key'], "END RSA PRIVATE KEY"))
105
					$input_errors[] = "This key does not appear to be valid.";
106
			}
107

    
108
			if (!$_POST['httpsname'] || !is_domain($_POST['httpsname'])) {
109
				$input_errors[] = "The HTTPS server name must be specified for HTTPS login.";
110
			}
111
		}
112
	}
113

    
114
	if ($_POST['timeout'] && (!is_numeric($_POST['timeout']) || ($_POST['timeout'] < 1))) {
115
		$input_errors[] = "The timeout must be at least 1 minute.";
116
	}
117
	if ($_POST['idletimeout'] && (!is_numeric($_POST['idletimeout']) || ($_POST['idletimeout'] < 1))) {
118
		$input_errors[] = "The idle timeout must be at least 1 minute.";
119
	}
120
	if (($_POST['radiusip'] && !is_ipaddr($_POST['radiusip']))) {
121
		$input_errors[] = "A valid IP address must be specified. [".$_POST['radiusip']."]";
122
	}
123
	if (($_POST['radiusport'] && !is_port($_POST['radiusport']))) {
124
		$input_errors[] = "A valid port number must be specified. [".$_POST['radiusport']."]";
125
	}
126
	if (($_POST['radiusacctport'] && !is_port($_POST['radiusacctport']))) {
127
		$input_errors[] = "A valid port number must be specified. [".$_POST['radiusport']."]";
128
	}
129

    
130
	if (!$input_errors) {
131
		$config['captiveportal']['interface'] = $_POST['cinterface'];
132
		$config['captiveportal']['timeout'] = $_POST['timeout'];
133
		$config['captiveportal']['idletimeout'] = $_POST['idletimeout'];
134
		$config['captiveportal']['enable'] = $_POST['enable'] ? true : false;
135
		$config['captiveportal']['auth_method'] = $_POST['auth_method'];
136
		$config['captiveportal']['radacct_enable'] = $_POST['radacct_enable'] ? true : false;
137
		$config['captiveportal']['httpslogin'] = $_POST['httpslogin_enable'] ? true : false;
138
		$config['captiveportal']['httpsname'] = $_POST['httpsname'];
139
		$config['captiveportal']['certificate'] = base64_encode($_POST['cert']);
140
		$config['captiveportal']['private-key'] = base64_encode($_POST['key']);
141
		$config['captiveportal']['logoutwin_enable'] = $_POST['logoutwin_enable'] ? true : false;
142
		$config['captiveportal']['peruserbw'] = $_POST['peruserbw'] ? true : false;
143
		$config['captiveportal']['bwauthmacup'] = $_POST['bwauthmacup'];
144
		$config['captiveportal']['bwauthmacdn'] = $_POST['bwauthmacdn'];
145
		$config['captiveportal']['bwauthipup'] = $_POST['bwauthipup'];
146
		$config['captiveportal']['bwauthipdn'] = $_POST['bwauthipdn'];
147
		$config['captiveportal']['bwdefaultup'] = $_POST['bwdefaultup'];
148
		$config['captiveportal']['bwdefaultdn'] = $_POST['bwdefaultdn'];
149
		$config['captiveportal']['nomacfilter'] = $_POST['nomacfilter'] ? true : false;
150
		$config['captiveportal']['redirurl'] = $_POST['redirurl'];
151
		$config['captiveportal']['radiusip'] = $_POST['radiusip'];
152
		$config['captiveportal']['radiusport'] = $_POST['radiusport'];
153
		$config['captiveportal']['radiusacctport'] = $_POST['radiusacctport'];
154
		$config['captiveportal']['radiuskey'] = $_POST['radiuskey'];
155

    
156
		/* file upload? */
157
		if (is_uploaded_file($_FILES['htmlfile']['tmp_name']))
158
			$config['captiveportal']['page']['htmltext'] = base64_encode(file_get_contents($_FILES['htmlfile']['tmp_name']));
159
		if (is_uploaded_file($_FILES['errfile']['tmp_name']))
160
			$config['captiveportal']['page']['errtext'] = base64_encode(file_get_contents($_FILES['errfile']['tmp_name']));
161

    
162
		write_config();
163

    
164
		$retval = 0;
165
		if (!file_exists($d_sysrebootreqd_path)) {
166
			config_lock();
167
			$retval = captiveportal_configure();
168
			config_unlock();
169
		}
170
		$savemsg = get_std_save_message($retval);
171
	}
172
}
173
?>
174
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
175
<html>
176
<head>
177
<title><?=gentitle("pfSense webGUI");?></title>
178
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
179
<link href="gui.css" rel="stylesheet" type="text/css">
180
</head>
181

    
182
<form method="post">
183

    
184
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
185
<?php include("fbegin.inc"); ?>
186
<script language="JavaScript">
187
<!--
188
function auth_method_change() {
189
	if (document.iform.auth_method[0].checked == false) {
190
		document.iform.logoutwin_enable.checked = 1;
191
	} else {
192
		document.iform.logoutwin_enable.checked = 0;
193
	}
194
}
195
function radacct_change() {
196
	if (document.iform.radacct_enable.checked) {
197
		auth_method_change();
198
	}
199
}
200

    
201
function enable_change(enable_change) {
202
	var endis;
203
	endis = !(document.iform.enable.checked || enable_change);
204

    
205
	document.iform.cinterface.disabled = endis;
206
	document.iform.idletimeout.disabled = endis;
207
	document.iform.timeout.disabled = endis;
208
	document.iform.redirurl.disabled = endis;
209
	document.iform.radiusip.disabled = endis;
210
	document.iform.radiusport.disabled = endis;
211
	document.iform.radiuskey.disabled = endis;
212
	document.iform.radacct_enable.disabled = endis;
213
	document.iform.auth_method[0].disabled = endis;
214
	document.iform.auth_method[1].disabled = endis;
215
	document.iform.auth_method[2].disabled = endis;
216
	document.iform.httpslogin_enable.disabled = endis;
217
	document.iform.httpsname.disabled = endis;
218
	document.iform.cert.disabled = endis;
219
	document.iform.key.disabled = endis;
220
	document.iform.logoutwin_enable.disabled = endis;
221
	document.iform.nomacfilter.disabled = endis;
222
	document.iform.htmlfile.disabled = endis;
223
	document.iform.errfile.disabled = endis;
224

    
225
	if (enable_change && document.iform.radacct_enable.checked) {
226
		document.iform.logoutwin_enable.checked = 1;
227
	}
228
	if (enable_change && document.iform.auth_method[0].checked == false) {
229
		document.iform.logoutwin_enable.checked = 1;
230
	}
231
}
232
//-->
233
</script>
234
<?php if ($input_errors) print_input_errors($input_errors); ?>
235
<?php if ($savemsg) print_info_box($savemsg); ?>
236
<form action="services_captiveportal.php" method="post" enctype="multipart/form-data" name="iform" id="iform">
237
<table width="100%" border="0" cellpadding="0" cellspacing="0">
238
  <tr><td class="tabnavtbl">
239
  <ul id="tabnav">
240
	<li class="tabact">Captive portal</li>
241
	<li class="tabinact"><a href="services_captiveportal_mac.php">Pass-through MAC</a></li>
242
	<li class="tabinact"><a href="services_captiveportal_ip.php">Allowed IP addresses</a></li>
243
	<li class="tabinact"><a href="services_captiveportal_users.php">Users</a></li>
244
  </ul>
245
  </td></tr>
246
  <tr>
247
  <td class="tabcont">
248
  <table width="100%" border="0" cellpadding="6" cellspacing="0">
249
	<tr>
250
	  <td width="22%" valign="top" class="vtable">&nbsp;</td>
251
	  <td width="78%" class="vtable">
252
		<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
253
		<strong>Enable captive portal </strong></td>
254
	</tr>
255
	<tr>
256
	  <td width="22%" valign="top" class="vncellreq">Interface</td>
257
	  <td width="78%" class="vtable">
258
		<select name="cinterface" class="formfld" id="cinterface">
259
		  <?php $interfaces = array('lan' => 'LAN');
260
		  for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
261
			if (isset($config['interfaces']['opt' . $i]['enable']))
262
				$interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
263
		  }
264
		  foreach ($interfaces as $iface => $ifacename): ?>
265
		  <option value="<?=$iface;?>" <?php if ($iface == $pconfig['cinterface']) echo "selected"; ?>>
266
		  <?=htmlspecialchars($ifacename);?>
267
		  </option>
268
		  <?php endforeach; ?>
269
		</select> <br>
270
		<span class="vexpl">Choose which interface to run the captive portal on.</span></td>
271
	</tr>
272
	<tr>
273
	  <td valign="top" class="vncell">Idle timeout</td>
274
	  <td class="vtable">
275
		<input name="idletimeout" type="text" class="formfld" id="idletimeout" size="6" value="<?=htmlspecialchars($pconfig['idletimeout']);?>">
276
minutes<br>
277
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>
278
	</tr>
279
	<tr>
280
	  <td width="22%" valign="top" class="vncell">Hard timeout</td>
281
	  <td width="78%" class="vtable">
282
		<input name="timeout" type="text" class="formfld" id="timeout" size="6" value="<?=htmlspecialchars($pconfig['timeout']);?>">
283
		minutes<br>
284
	  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>
285
	</tr>
286
	<tr>
287
	  <td width="22%" valign="top" class="vncell">Logout popup window</td>
288
	  <td width="78%" class="vtable">
289
		<input name="logoutwin_enable" type="checkbox" class="formfld" id="logoutwin_enable" value="yes" <?php if($pconfig['logoutwin_enable']) echo "checked"; ?>>
290
		<strong>Enable logout popup window</strong><br>
291
	  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. When RADIUS accounting is  enabled, this option is implied.</td>
292
	</tr>
293
	<tr>
294
	  <td valign="top" class="vncell">Redirection URL</td>
295
	  <td class="vtable">
296
		<input name="redirurl" type="text" class="formfld" id="redirurl" size="60" value="<?=htmlspecialchars($pconfig['redirurl']);?>">
297
		<br>
298
If you provide a URL here, clients will be redirected to that URL instead of the one they initially tried
299
to access after they've authenticated.</td>
300
	</tr>
301
	<tr>
302
      <td valign="top" class="vncell">MAC filtering </td>
303
      <td class="vtable">
304
        <input name="nomacfilter" type="checkbox" class="formfld" id="nomacfilter" value="yes" <?php if ($pconfig['nomacfilter']) echo "checked"; ?>>
305
        <strong>Disable MAC filtering</strong><br>
306
    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. This is required when the MAC address cannot be determined (usually because there are routers between m0n0wall and the clients).</td>
307
	  </tr>
308
	  <tr>
309
      <td valign="top" class="vncell">Per-user bandwidth restriction</td>
310
      <td class="vtable">
311
		  <input name="peruserbw" type="checkbox" class="formfld" id="peruserbw" value="yes" <?php if ($pconfig['peruserbw']) echo "checked"; ?>>
312
          <strong>Enable per-user bandwidth restriction	</strong><br><br>
313
		<table cellpadding="0" cellspacing="0">
314
		<tr>
315
		<td>Pass-through MAC download&nbsp;&nbsp;</td>
316
		<td><input type="text" class="formfld" id="bwauthmacdn" size="5" value="<?=htmlspecialchars($pconfig['bwauthmacdn']);?>"> Kbit/s</td>
317
		</tr><tr>
318
		<td>Pass-through MAC upload</td>
319
		<td><input type="text" class="formfld" id="bwauthmacdn" size="5" value="<?=htmlspecialchars($pconfig['bwauthmacup']);?>"> Kbit/s</td>
320
		</tr><tr>
321
		<td>Pass-through IP download</td>
322
		<td><input type="text" class="formfld" id="bwauthipdn" size="5" value="<?=htmlspecialchars($pconfig['bwauthipdn']);?>"> Kbit/s</td>
323
		</tr><tr>
324
		<td>Pass-through IP upload</td>
325
		<td><input type="text" class="formfld" id="bwauthipup" size="5" value="<?=htmlspecialchars($pconfig['bwauthipup']);?>"> Kbit/s</td>
326
		</tr><tr>
327
		<td>Default download</td>
328
		<td><input type="text" class="formfld" id="bwdefaultdn" size="5" value="<?=htmlspecialchars($pconfig['bwdefaultdn']);?>"> Kbit/s</td>
329
		</tr><tr>
330
		<td>Default upload</td>
331
		<td><input type="text" class="formfld" id="bwdefaultup" size="5" value="<?=htmlspecialchars($pconfig['bwdefaultup']);?>"> Kbit/s</td>
332
		</tr></table>
333
        <br>
334
    If this option is set, the captive portal will restrict each user who logs in to a specific bandwidth as set in RADIUS. Your RADIUS server must return the attributes Nomadix-Bw-Up and Nomadix-Bw-Down (1 and 2 VSAs from Vendor 3309, Nomadix) along with Access-Accept for this to work. Bandwidth is set in Kbit/s. You can control pass-through and default bandwidths above.</td>
335
	  </tr>
336
	<tr>
337
	  <td width="22%" valign="top" class="vncell">RADIUS server</td>
338
	  <td width="78%" class="vtable">
339
		<table cellpadding="0" cellspacing="0">
340
		<td>No Authentication:&nbsp;&nbsp;</td>
341
 		<td><input name="auth_method" type="radio" id="auth_method" value="none" <?php if($pconfig['auth_method']!="local" || $pconfig['auth_method']!="radius") echo "checked"; ?> onClick="auth_method_change()"></td>
342
		</tr>
343
		<td>Local <a href="services_captiveportal_users.php">Usermanager</a>:&nbsp;&nbsp;</td>
344
 		<td><input name="auth_method" type="radio" id="auth_method" value="local" <?php if($pconfig['auth_method']=="local") echo "checked"; ?> onClick="auth_method_change()"></td>
345
		</tr>
346
		<td>RADIUS Authentication:&nbsp;&nbsp;</td>
347
 		<td><input name="auth_method" type="radio" id="auth_method" value="radius" <?php if($pconfig['auth_method']=="radius") echo "checked"; ?> onClick="auth_method_change()"></td>
348
		</tr>
349
		<tr>
350
		<td>IP address:</td>
351
		<td><input name="radiusip" type="text" class="formfld" id="radiusip" size="20" value="<?=htmlspecialchars($pconfig['radiusip']);?>"></td>
352
		</tr><tr>
353
		<td>Port:</td>
354
		<td><input name="radiusport" type="text" class="formfld" id="radiusport" size="5" value="<?=htmlspecialchars($pconfig['radiusport']);?>"></td>
355
		</tr><tr>
356
		<td>Shared secret:&nbsp;&nbsp;</td>
357
		<td><input name="radiuskey" type="text" class="formfld" id="radiuskey" size="16" value="<?=htmlspecialchars($pconfig['radiuskey']);?>"> </td>
358
 		</tr>
359
		<tr>
360
          <td>Accounting:&nbsp;&nbsp;</td>
361
          <td><input name="radacct_enable" type="checkbox" id="radacct_enable" value="yes" <?php if($pconfig['radacct_enable']) echo "checked"; ?> onClick="radacct_change()"></td>
362
		  </tr>
363
		<tr>
364
          <td>Accounting port:&nbsp;&nbsp;</td>
365
          <td><input name="radiusacctport" type="text" class="formfld" id="radiusacctport" size="5" value="<?=htmlspecialchars($pconfig['radiusacctport']);?>"></td>
366
		  </tr></table>
367
 		<br>
368
 	Enter the IP address and port of the RADIUS server which users of the captive portal have to authenticate against. Leave blank to disable RADIUS authentication. Leave port number blank to use the default port (1812). Leave the RADIUS shared secret blank to not use a RADIUS shared secret. RADIUS accounting packets will also be sent to the RADIUS server if  accounting is enabled (default port is 1813).
369
	</tr>
370
	<tr>
371
      <td valign="top" class="vncell">HTTPS login</td>
372
      <td class="vtable">
373
        <input name="httpslogin_enable" type="checkbox" class="formfld" id="httpslogin_enable" value="yes" <?php if($pconfig['httpslogin_enable']) echo "checked"; ?>>
374
        <strong>Enable HTTPS login</strong><br>
375
    If enabled, the username and password will be transmitted over an HTTPS connection to protect against eavesdroppers. This option only applies when RADIUS authentication is used. A server name, certificate and matching private key must also be specified below.</td>
376
	  </tr>
377
	<tr>
378
      <td valign="top" class="vncell">HTTPS server name </td>
379
      <td class="vtable">
380
        <input name="httpsname" type="text" class="formfld" id="httpsname" size="30" value="<?=htmlspecialchars($pconfig['httpsname']);?>"><br>
381
    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. </td>
382
	  </tr>
383
	<tr>
384
      <td valign="top" class="vncell">HTTPS certificate</td>
385
      <td class="vtable">
386
        <textarea name="cert" cols="65" rows="7" id="cert" class="formpre"><?=htmlspecialchars($pconfig['cert']);?></textarea>
387
        <br>
388
    Paste a signed certificate in X.509 PEM format here.</td>
389
	  </tr>
390
	<tr>
391
      <td valign="top" class="vncell">HTTPS private key</td>
392
      <td class="vtable">
393
        <textarea name="key" cols="65" rows="7" id="key" class="formpre"><?=htmlspecialchars($pconfig['key']);?></textarea>
394
        <br>
395
    Paste an RSA private key in PEM format here.</td>
396
	  </tr>
397
	<tr>
398
	  <td width="22%" valign="top" class="vncellreq">Portal page contents</td>
399
	  <td width="78%" class="vtable">
400
		<?=$mandfldhtml;?><input type="file" name="htmlfile" class="formfld" id="htmlfile"><br>
401
		<?php if ($config['captiveportal']['page']['htmltext']): ?>
402
		<a href="?act=viewhtml" target="_blank">View current page</a>
403
		  <br>
404
		  <br>
405
		<?php endif; ?>
406
		  Upload an HTML file for the portal page here (leave blank to keep the current one). Make sure to include a form (POST to &quot;$PORTAL_ACTION$&quot;)
407
with a submit button (name=&quot;accept&quot;) and a hidden field with name=&quot;redirurl&quot; and value=&quot;$PORTAL_REDIRURL$&quot;. Include the &quot;auth_user&quot; and &quot;auth_pass&quot; input elements if RADIUS authentication is enabled. If RADIUS is enabled and no &quot;auth_user&quot; is present, authentication will always fail. If RADIUS is not enabled, you can omit both of these input elements. Example code for the form:<br>
408
		  <br>
409
		  <tt>&lt;form method=&quot;post&quot; action=&quot;$PORTAL_ACTION$&quot;&gt;<br>
410
		  &nbsp;&nbsp;&nbsp;&lt;input name=&quot;auth_user&quot; type=&quot;text&quot;&gt;<br>
411
		  &nbsp;&nbsp;&nbsp;&lt;input name=&quot;auth_pass&quot; type=&quot;password&quot;&gt;<br>
412
		  &nbsp;&nbsp;&nbsp;&lt;input name=&quot;redirurl&quot; type=&quot;hidden&quot; value=&quot;$PORTAL_REDIRURL$&quot;&gt;<br>
413
&nbsp;&nbsp;&nbsp;&lt;input name=&quot;accept&quot; type=&quot;submit&quot; value=&quot;Continue&quot;&gt;<br>
414
		  &lt;/form&gt;</tt></td>
415
	</tr>
416
	<tr>
417
	  <td width="22%" valign="top" class="vncell">Authentication<br>
418
		error page<br>
419
		contents</td>
420
	  <td class="vtable">
421
		<input name="errfile" type="file" class="formfld" id="errfile"><br>
422
		<?php if ($config['captiveportal']['page']['errtext']): ?>
423
		<a href="?act=viewerrhtml" target="_blank">View current page</a>
424
		  <br>
425
		  <br>
426
		<?php endif; ?>
427
The contents of the HTML file that you upload here are displayed when a RADIUS authentication error occurs.</td>
428
	</tr>
429
	<tr>
430
	  <td width="22%" valign="top">&nbsp;</td>
431
	  <td width="78%">
432
		<input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change(true)">
433
	  </td>
434
	</tr>
435
	<tr>
436
	  <td width="22%" valign="top">&nbsp;</td>
437
	  <td width="78%"><span class="vexpl"><span class="red"><strong>Note:<br>
438
		</strong></span>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>
439
	</tr>
440
  </table>
441
  </td>
442
  </tr>
443
  </table>
444
</form>
445
<script language="JavaScript">
446
<!--
447
enable_change(false);
448
//-->
449
</script>
450
<?php include("fend.inc"); ?>
(66-66/109)