Project

General

Profile

Download (20.4 KB) Statistics
| Branch: | Tag: | Revision:
1 5b237745 Scott Ullrich
#!/usr/local/bin/php
2 c980716e Scott Ullrich
<?php 
3 5b237745 Scott Ullrich
/*
4
	services_captiveportal.php
5
	part of m0n0wall (http://m0n0.ch/wall)
6 c980716e Scott Ullrich
	
7 9699028a Scott Ullrich
	Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
8 5b237745 Scott Ullrich
	All rights reserved.
9 c980716e Scott Ullrich
	
10 5b237745 Scott Ullrich
	Redistribution and use in source and binary forms, with or without
11
	modification, are permitted provided that the following conditions are met:
12 c980716e Scott Ullrich
	
13 5b237745 Scott Ullrich
	1. Redistributions of source code must retain the above copyright notice,
14
	   this list of conditions and the following disclaimer.
15 c980716e Scott Ullrich
	
16 5b237745 Scott Ullrich
	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 c980716e Scott Ullrich
	
20 5b237745 Scott Ullrich
	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
require("guiconfig.inc");
33
34
if (!is_array($config['captiveportal'])) {
35
	$config['captiveportal'] = array();
36
	$config['captiveportal']['page'] = array();
37
	$config['captiveportal']['timeout'] = 60;
38
}
39
40
if ($_GET['act'] == "viewhtml") {
41
	echo base64_decode($config['captiveportal']['page']['htmltext']);
42
	exit;
43
} else if ($_GET['act'] == "viewerrhtml") {
44
	echo base64_decode($config['captiveportal']['page']['errtext']);
45
	exit;
46
}
47
48
$pconfig['cinterface'] = $config['captiveportal']['interface'];
49
$pconfig['timeout'] = $config['captiveportal']['timeout'];
50
$pconfig['idletimeout'] = $config['captiveportal']['idletimeout'];
51
$pconfig['enable'] = isset($config['captiveportal']['enable']);
52 7faeda46 Scott Ullrich
$pconfig['auth_method'] = $config['captiveportal']['auth_method'];
53 5b237745 Scott Ullrich
$pconfig['radacct_enable'] = isset($config['captiveportal']['radacct_enable']);
54 c980716e Scott Ullrich
$pconfig['reauthenticate'] = isset($config['captiveportal']['reauthenticate']);
55
$pconfig['reauthenticateacct'] = $config['captiveportal']['reauthenticateacct'];
56 5b237745 Scott Ullrich
$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['redirurl'] = $config['captiveportal']['redirurl'];
63
$pconfig['radiusip'] = $config['captiveportal']['radiusip'];
64
$pconfig['radiusport'] = $config['captiveportal']['radiusport'];
65
$pconfig['radiusacctport'] = $config['captiveportal']['radiusacctport'];
66
$pconfig['radiuskey'] = $config['captiveportal']['radiuskey'];
67
68
if ($_POST) {
69
70
	unset($input_errors);
71
	$pconfig = $_POST;
72
73
	/* input validation */
74
	if ($_POST['enable']) {
75
		$reqdfields = explode(" ", "cinterface");
76
		$reqdfieldsn = explode(",", "Interface");
77 c980716e Scott Ullrich
		
78 5b237745 Scott Ullrich
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
79 c980716e Scott Ullrich
		
80 5b237745 Scott Ullrich
		if ($_POST['httpslogin_enable']) {
81
		 	if (!$_POST['cert'] || !$_POST['key']) {
82
				$input_errors[] = "Certificate and key must be specified for HTTPS login.";
83
			} else {
84
				if (!strstr($_POST['cert'], "BEGIN CERTIFICATE") || !strstr($_POST['cert'], "END CERTIFICATE"))
85
					$input_errors[] = "This certificate does not appear to be valid.";
86
				if (!strstr($_POST['key'], "BEGIN RSA PRIVATE KEY") || !strstr($_POST['key'], "END RSA PRIVATE KEY"))
87
					$input_errors[] = "This key does not appear to be valid.";
88
			}
89 c980716e Scott Ullrich
			
90 5b237745 Scott Ullrich
			if (!$_POST['httpsname'] || !is_domain($_POST['httpsname'])) {
91
				$input_errors[] = "The HTTPS server name must be specified for HTTPS login.";
92
			}
93
		}
94
	}
95 c980716e Scott Ullrich
	
96 5b237745 Scott Ullrich
	if ($_POST['timeout'] && (!is_numeric($_POST['timeout']) || ($_POST['timeout'] < 1))) {
97
		$input_errors[] = "The timeout must be at least 1 minute.";
98
	}
99
	if ($_POST['idletimeout'] && (!is_numeric($_POST['idletimeout']) || ($_POST['idletimeout'] < 1))) {
100
		$input_errors[] = "The idle timeout must be at least 1 minute.";
101
	}
102
	if (($_POST['radiusip'] && !is_ipaddr($_POST['radiusip']))) {
103
		$input_errors[] = "A valid IP address must be specified. [".$_POST['radiusip']."]";
104
	}
105
	if (($_POST['radiusport'] && !is_port($_POST['radiusport']))) {
106
		$input_errors[] = "A valid port number must be specified. [".$_POST['radiusport']."]";
107
	}
108
	if (($_POST['radiusacctport'] && !is_port($_POST['radiusacctport']))) {
109
		$input_errors[] = "A valid port number must be specified. [".$_POST['radiusport']."]";
110
	}
111
112
	if (!$input_errors) {
113
		$config['captiveportal']['interface'] = $_POST['cinterface'];
114
		$config['captiveportal']['timeout'] = $_POST['timeout'];
115
		$config['captiveportal']['idletimeout'] = $_POST['idletimeout'];
116 7faeda46 Scott Ullrich
		$config['captiveportal']['auth_method'] = $_POST['auth_method'];
117 c980716e Scott Ullrich
		$config['captiveportal']['reauthenticateacct'] = $_POST['reauthenticateacct'];
118 5b237745 Scott Ullrich
		$config['captiveportal']['httpsname'] = $_POST['httpsname'];
119
		$config['captiveportal']['certificate'] = base64_encode($_POST['cert']);
120
		$config['captiveportal']['private-key'] = base64_encode($_POST['key']);
121
		$config['captiveportal']['redirurl'] = $_POST['redirurl'];
122
		$config['captiveportal']['radiusip'] = $_POST['radiusip'];
123
		$config['captiveportal']['radiusport'] = $_POST['radiusport'];
124
		$config['captiveportal']['radiusacctport'] = $_POST['radiusacctport'];
125
		$config['captiveportal']['radiuskey'] = $_POST['radiuskey'];
126 93008d1b Scott Ullrich
127
		if($_POST['radacct_enable'] == "yes")
128
			$config['captiveportal']['radacct_enable'] = true;
129
		else 
130
			unset($config['captiveportal']['radacct_enable']);
131
132
		if($_POST['reauthenticate'] == "yes")
133
			$config['captiveportal']['reauthenticate'] = true;
134
		else
135
			unset($config['captiveportal']['reauthenticate']);
136
		
137
		if($_POST['enable'] == "yes")
138
			$config['captiveportal']['enable'] = true;
139
		else
140
			unset($config['captiveportal']['enable']);
141
			
142
		if($_POST['httpslogin_enable'] == "yes")
143
			$config['captiveportal']['httpslogin'] =  true;
144
		else
145
			unset($config['captiveportal']['httpslogin']);
146
		
147
		if($_POST['logoutwin_enable'] == "yes")
148
			$config['captiveportal']['logoutwin_enable'] = true;
149
		else
150
			unset($config['captiveportal']['logoutwin_enable']);
151
152
		if($_POST['nomacfilter'] == "yes")
153
			$config['captiveportal']['nomacfilter'] = true;
154
		else
155
			unset($config['captiveportal']['nomacfilter']);
156 c980716e Scott Ullrich
		
157 5b237745 Scott Ullrich
		/* file upload? */
158
		if (is_uploaded_file($_FILES['htmlfile']['tmp_name']))
159
			$config['captiveportal']['page']['htmltext'] = base64_encode(file_get_contents($_FILES['htmlfile']['tmp_name']));
160 c980716e Scott Ullrich
		if (is_uploaded_file($_FILES['errfile']['tmp_name']))
161 5b237745 Scott Ullrich
			$config['captiveportal']['page']['errtext'] = base64_encode(file_get_contents($_FILES['errfile']['tmp_name']));
162 c980716e Scott Ullrich
			
163 5b237745 Scott Ullrich
		write_config();
164 c980716e Scott Ullrich
		
165 5b237745 Scott Ullrich
		$retval = 0;
166
		if (!file_exists($d_sysrebootreqd_path)) {
167
			config_lock();
168
			$retval = captiveportal_configure();
169
			config_unlock();
170
		}
171
		$savemsg = get_std_save_message($retval);
172
	}
173
}
174 3d4bd975 Scott Ullrich
175
$pgtitle = "Services: Captive Portal";
176
include("head.inc");
177
178 5b237745 Scott Ullrich
?>
179 3d4bd975 Scott Ullrich
<body link="#000000" vlink="#000000" alink="#000000">
180 9699028a Scott Ullrich
<?php include("fbegin.inc"); ?>
181 5b237745 Scott Ullrich
<script language="JavaScript">
182
<!--
183
function enable_change(enable_change) {
184 07bd3f83 Scott Ullrich
	var endis;
185
	endis = !(document.iform.enable.checked || enable_change);
186 c980716e Scott Ullrich
	
187 07bd3f83 Scott Ullrich
	document.iform.cinterface.disabled = endis;
188
	document.iform.idletimeout.disabled = endis;
189
	document.iform.timeout.disabled = endis;
190
	document.iform.redirurl.disabled = endis;
191
	document.iform.radiusip.disabled = endis;
192
	document.iform.radiusport.disabled = endis;
193
	document.iform.radiuskey.disabled = endis;
194
	document.iform.radacct_enable.disabled = endis;
195 c980716e Scott Ullrich
	document.iform.radiusacctport.disabled = endis;
196
	document.iform.reauthenticate.disabled = endis;
197
	document.iform.reauthenticateacct.disabled = endis;
198 7faeda46 Scott Ullrich
	document.iform.auth_method[0].disabled = endis;
199
	document.iform.auth_method[1].disabled = endis;
200
	document.iform.auth_method[2].disabled = endis;
201 07bd3f83 Scott Ullrich
	document.iform.httpslogin_enable.disabled = endis;
202
	document.iform.httpsname.disabled = endis;
203
	document.iform.cert.disabled = endis;
204
	document.iform.key.disabled = endis;
205
	document.iform.logoutwin_enable.disabled = endis;
206 c980716e Scott Ullrich
	document.iform.nomacfilter.disabled = endis;
207 07bd3f83 Scott Ullrich
	document.iform.htmlfile.disabled = endis;
208
	document.iform.errfile.disabled = endis;
209 5b237745 Scott Ullrich
}
210
//-->
211
</script>
212 4900ba6e Scott Ullrich
<p class="pgtitle">Services: Captive portal</p>
213 5b237745 Scott Ullrich
<?php if ($input_errors) print_input_errors($input_errors); ?>
214
<?php if ($savemsg) print_info_box($savemsg); ?>
215
<form action="services_captiveportal.php" method="post" enctype="multipart/form-data" name="iform" id="iform">
216
<table width="100%" border="0" cellpadding="0" cellspacing="0">
217 9699028a Scott Ullrich
  <tr><td class="tabnavtbl">
218 64b85ffe Scott Ullrich
<?php
219
	$tab_array = array();
220
	$tab_array[] = array("Captive portal", true, "services_captiveportal.php");
221
	$tab_array[] = array("Pass-through MAC", false, "services_captiveportal_mac.php");
222
	$tab_array[] = array("Allowed IP addresses", false, "services_captiveportal_ip.php");
223 4e9dc150 Scott Ullrich
	$tab_array[] = array("Users", false, "services_captiveportal_users.php");
224 64b85ffe Scott Ullrich
	display_top_tabs($tab_array);
225
?>  
226 5b237745 Scott Ullrich
  </td></tr>
227
  <tr>
228 c980716e Scott Ullrich
  <td class="tabcont">
229
  <table width="100%" border="0" cellpadding="6" cellspacing="0">
230
	<tr> 
231 5b237745 Scott Ullrich
	  <td width="22%" valign="top" class="vtable">&nbsp;</td>
232
	  <td width="78%" class="vtable">
233
		<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
234
		<strong>Enable captive portal </strong></td>
235
	</tr>
236 c980716e Scott Ullrich
	<tr> 
237 5b237745 Scott Ullrich
	  <td width="22%" valign="top" class="vncellreq">Interface</td>
238
	  <td width="78%" class="vtable">
239
		<select name="cinterface" class="formfld" id="cinterface">
240 c980716e Scott Ullrich
		  <?php $interfaces = array('lan' => 'LAN');
241
		  for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
242
			if (isset($config['interfaces']['opt' . $i]['enable']))
243
				$interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
244
		  }
245
		  foreach ($interfaces as $iface => $ifacename): ?>
246
		  <option value="<?=$iface;?>" <?php if ($iface == $pconfig['cinterface']) echo "selected"; ?>> 
247 5b237745 Scott Ullrich
		  <?=htmlspecialchars($ifacename);?>
248
		  </option>
249
		  <?php endforeach; ?>
250
		</select> <br>
251
		<span class="vexpl">Choose which interface to run the captive portal on.</span></td>
252
	</tr>
253
	<tr>
254
	  <td valign="top" class="vncell">Idle timeout</td>
255
	  <td class="vtable">
256
		<input name="idletimeout" type="text" class="formfld" id="idletimeout" size="6" value="<?=htmlspecialchars($pconfig['idletimeout']);?>">
257
minutes<br>
258
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>
259
	</tr>
260 c980716e Scott Ullrich
	<tr> 
261 5b237745 Scott Ullrich
	  <td width="22%" valign="top" class="vncell">Hard timeout</td>
262 c980716e Scott Ullrich
	  <td width="78%" class="vtable"> 
263
		<input name="timeout" type="text" class="formfld" id="timeout" size="6" value="<?=htmlspecialchars($pconfig['timeout']);?>"> 
264 5b237745 Scott Ullrich
		minutes<br>
265
	  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>
266
	</tr>
267 c980716e Scott Ullrich
	<tr> 
268 5b237745 Scott Ullrich
	  <td width="22%" valign="top" class="vncell">Logout popup window</td>
269 c980716e Scott Ullrich
	  <td width="78%" class="vtable"> 
270 5b237745 Scott Ullrich
		<input name="logoutwin_enable" type="checkbox" class="formfld" id="logoutwin_enable" value="yes" <?php if($pconfig['logoutwin_enable']) echo "checked"; ?>>
271
		<strong>Enable logout popup window</strong><br>
272 c980716e Scott Ullrich
	  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>
273 5b237745 Scott Ullrich
	</tr>
274
	<tr>
275
	  <td valign="top" class="vncell">Redirection URL</td>
276
	  <td class="vtable">
277
		<input name="redirurl" type="text" class="formfld" id="redirurl" size="60" value="<?=htmlspecialchars($pconfig['redirurl']);?>">
278
		<br>
279
If you provide a URL here, clients will be redirected to that URL instead of the one they initially tried
280
to access after they've authenticated.</td>
281
	</tr>
282
	<tr>
283 c980716e Scott Ullrich
      <td valign="top" class="vncell">MAC filtering </td>
284
      <td class="vtable">
285
        <input name="nomacfilter" type="checkbox" class="formfld" id="nomacfilter" value="yes" <?php if ($pconfig['nomacfilter']) echo "checked"; ?>>
286
        <strong>Disable MAC filtering</strong><br>
287
    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 of cannot be determined (usually because there are routers between m0n0wall and the clients).</td>
288
	  </tr>
289
	<tr> 
290
	  <td width="22%" valign="top" class="vncell">Authentication</td>
291
	  <td width="78%" class="vtable"> 
292
		<table cellpadding="0" cellspacing="0">
293
		<tr>
294
		  <td colspan="2"><input name="auth_method" type="radio" id="auth_method" value="none" <?php if($pconfig['auth_method']!="local" && $pconfig['auth_method']!="radius") echo "checked"; ?>>
295
  No authentication</td>  
296
		  </tr>
297
		<tr>
298
		  <td colspan="2"><input name="auth_method" type="radio" id="auth_method" value="local" <?php if($pconfig['auth_method']=="local") echo "checked"; ?>>
299
  Local <a href="services_captiveportal_users.php">user manager</a></td>  
300
		  </tr>
301
		<tr>
302
		  <td colspan="2"><input name="auth_method" type="radio" id="auth_method" value="radius" <?php if($pconfig['auth_method']=="radius") echo "checked"; ?>>
303
  RADIUS authentication</td>  
304
		  </tr><tr>
305
		  <td>&nbsp;</td>
306
		  <td>&nbsp;</td>
307
		  </tr>
308 5b237745 Scott Ullrich
		<tr>
309
		<td>IP address:</td>
310
		<td><input name="radiusip" type="text" class="formfld" id="radiusip" size="20" value="<?=htmlspecialchars($pconfig['radiusip']);?>"></td>
311
		</tr><tr>
312
		<td>Port:</td>
313
		<td><input name="radiusport" type="text" class="formfld" id="radiusport" size="5" value="<?=htmlspecialchars($pconfig['radiusport']);?>"></td>
314
		</tr><tr>
315
		<td>Shared secret:&nbsp;&nbsp;</td>
316
		<td><input name="radiuskey" type="text" class="formfld" id="radiuskey" size="16" value="<?=htmlspecialchars($pconfig['radiuskey']);?>"> </td>
317
 		</tr>
318
		<tr>
319
          <td>Accounting:&nbsp;&nbsp;</td>
320 c980716e Scott Ullrich
          <td><input name="radacct_enable" type="checkbox" id="radacct_enable" value="yes" <?php if($pconfig['radacct_enable']) echo "checked"; ?>>
321
          send RADIUS accounting packets</td>
322 5b237745 Scott Ullrich
		  </tr>
323
		<tr>
324
          <td>Accounting port:&nbsp;&nbsp;</td>
325
          <td><input name="radiusacctport" type="text" class="formfld" id="radiusacctport" size="5" value="<?=htmlspecialchars($pconfig['radiusacctport']);?>"></td>
326 c980716e Scott Ullrich
		  </tr>
327
		<tr>
328
          <td valign="top">Reauthentication:&nbsp;&nbsp;</td>
329
          <td><input name="reauthenticate" type="checkbox" id="reauthenticate" value="yes" <?php if($pconfig['reauthenticate']) echo "checked"; ?>>
330
          reauthenticate connected users every minute<br><br>
331
          <input name="reauthenticateacct" type="radio" value="" <?php if(!$pconfig['reauthenticateacct']) echo "checked"; ?>> no accounting updates<br>
332
          <input name="reauthenticateacct" type="radio" value="stopstart" <?php if($pconfig['reauthenticateacct'] == "stopstart") echo "checked"; ?>> stop/start accounting<br>
333
          <input name="reauthenticateacct" type="radio" value="interimupdate" <?php if($pconfig['reauthenticateacct'] == "interimupdate") echo "checked"; ?>> interim update</td>
334
		  </tr>
335
		</table>
336 5b237745 Scott Ullrich
 		<br>
337 c980716e Scott Ullrich
 	When using RADIUS authentication, enter the IP address and port of the RADIUS server which users of the captive portal have to authenticate against.  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).
338
 	<br><br>If reauthentication is enabled, Access-Requests will be sent to the RADIUS server for each user that is logged in every minute. If an Access-Reject is received for a user, that user is disconnected from the captive portal immediately.
339 5b237745 Scott Ullrich
	</tr>
340
	<tr>
341
      <td valign="top" class="vncell">HTTPS login</td>
342
      <td class="vtable">
343 c980716e Scott Ullrich
        <input name="httpslogin_enable" type="checkbox" class="formfld" id="httpslogin_enable" value="yes" <?php if($pconfig['httpslogin_enable']) echo "checked"; ?>>
344 5b237745 Scott Ullrich
        <strong>Enable HTTPS login</strong><br>
345
    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>
346
	  </tr>
347
	<tr>
348
      <td valign="top" class="vncell">HTTPS server name </td>
349
      <td class="vtable">
350
        <input name="httpsname" type="text" class="formfld" id="httpsname" size="30" value="<?=htmlspecialchars($pconfig['httpsname']);?>"><br>
351
    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>
352
	  </tr>
353
	<tr>
354
      <td valign="top" class="vncell">HTTPS certificate</td>
355
      <td class="vtable">
356
        <textarea name="cert" cols="65" rows="7" id="cert" class="formpre"><?=htmlspecialchars($pconfig['cert']);?></textarea>
357
        <br>
358 9699028a Scott Ullrich
    Paste a signed certificate in X.509 PEM format here.</td>
359 5b237745 Scott Ullrich
	  </tr>
360
	<tr>
361
      <td valign="top" class="vncell">HTTPS private key</td>
362
      <td class="vtable">
363
        <textarea name="key" cols="65" rows="7" id="key" class="formpre"><?=htmlspecialchars($pconfig['key']);?></textarea>
364
        <br>
365
    Paste an RSA private key in PEM format here.</td>
366
	  </tr>
367 c980716e Scott Ullrich
	<tr> 
368 5b237745 Scott Ullrich
	  <td width="22%" valign="top" class="vncellreq">Portal page contents</td>
369 c980716e Scott Ullrich
	  <td width="78%" class="vtable">    
370 9699028a Scott Ullrich
		<?=$mandfldhtml;?><input type="file" name="htmlfile" class="formfld" id="htmlfile"><br>
371 5b237745 Scott Ullrich
		<?php if ($config['captiveportal']['page']['htmltext']): ?>
372 c980716e Scott Ullrich
		<a href="?act=viewhtml" target="_blank">View current page</a>                      
373 5b237745 Scott Ullrich
		  <br>
374
		  <br>
375
		<?php endif; ?>
376
		  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;)
377 07bd3f83 Scott Ullrich
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>
378 5b237745 Scott Ullrich
		  <br>
379
		  <tt>&lt;form method=&quot;post&quot; action=&quot;$PORTAL_ACTION$&quot;&gt;<br>
380
		  &nbsp;&nbsp;&nbsp;&lt;input name=&quot;auth_user&quot; type=&quot;text&quot;&gt;<br>
381
		  &nbsp;&nbsp;&nbsp;&lt;input name=&quot;auth_pass&quot; type=&quot;password&quot;&gt;<br>
382
		  &nbsp;&nbsp;&nbsp;&lt;input name=&quot;redirurl&quot; type=&quot;hidden&quot; value=&quot;$PORTAL_REDIRURL$&quot;&gt;<br>
383
&nbsp;&nbsp;&nbsp;&lt;input name=&quot;accept&quot; type=&quot;submit&quot; value=&quot;Continue&quot;&gt;<br>
384
		  &lt;/form&gt;</tt></td>
385
	</tr>
386
	<tr>
387
	  <td width="22%" valign="top" class="vncell">Authentication<br>
388
		error page<br>
389
		contents</td>
390
	  <td class="vtable">
391
		<input name="errfile" type="file" class="formfld" id="errfile"><br>
392
		<?php if ($config['captiveportal']['page']['errtext']): ?>
393 c980716e Scott Ullrich
		<a href="?act=viewerrhtml" target="_blank">View current page</a>                      
394 5b237745 Scott Ullrich
		  <br>
395
		  <br>
396
		<?php endif; ?>
397 c980716e Scott Ullrich
The contents of the HTML file that you upload here are displayed when a RADIUS authentication error occurs.</td>
398 5b237745 Scott Ullrich
	</tr>
399 c980716e Scott Ullrich
	<tr> 
400 5b237745 Scott Ullrich
	  <td width="22%" valign="top">&nbsp;</td>
401 c980716e Scott Ullrich
	  <td width="78%"> 
402
		<input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change(true)"> 
403 5b237745 Scott Ullrich
	  </td>
404
	</tr>
405 c980716e Scott Ullrich
	<tr> 
406 5b237745 Scott Ullrich
	  <td width="22%" valign="top">&nbsp;</td>
407
	  <td width="78%"><span class="vexpl"><span class="red"><strong>Note:<br>
408 c980716e Scott Ullrich
		</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>
409 5b237745 Scott Ullrich
	</tr>
410
  </table>
411
  </td>
412
  </tr>
413
  </table>
414
</form>
415
<script language="JavaScript">
416
<!--
417
enable_change(false);
418
//-->
419
</script>
420
<?php include("fend.inc"); ?>