services_captiveportal.php

Davy Moedbeck, 08/20/2011 08:13 am

Download (44.5 kB)

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

    
110
if ($_POST) {
111

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

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

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

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

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

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

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

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

    
221
                /* file upload? */
222
                if (is_uploaded_file($_FILES['htmlfile']['tmp_name']))
223
                        $config['captiveportal']['page']['htmltext'] = base64_encode(file_get_contents($_FILES['htmlfile']['tmp_name']));
224
                if (is_uploaded_file($_FILES['errfile']['tmp_name']))
225
                        $config['captiveportal']['page']['errtext'] = base64_encode(file_get_contents($_FILES['errfile']['tmp_name']));
226
                if (is_uploaded_file($_FILES['logoutfile']['tmp_name']))
227
                        $config['captiveportal']['page']['logouttext'] = base64_encode(file_get_contents($_FILES['logoutfile']['tmp_name']));
228

    
229
                write_config();
230

    
231
                $retval = 0;
232
                $retval = captiveportal_configure();
233

    
234
                $savemsg = get_std_save_message($retval);
235
                
236
                if (is_array($_POST['cinterface']))
237
                        $pconfig['cinterface'] = implode(",", $_POST['cinterface']);
238

    
239
                filter_configure();
240
        }
241
}
242
include("head.inc");
243
?>
244
<?php include("fbegin.inc"); ?>
245
<script language="JavaScript">
246
<!--
247
function enable_change(enable_change) {
248
        var endis, radius_endis;
249
        endis = !(document.iform.enable.checked || enable_change);
250
        radius_endis = !((!endis && document.iform.auth_method[2].checked) || enable_change);
251

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

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

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

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

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

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

    
615
                        <tr>
616
                                <td class="vncell" valign="top"><?=gettext("Session-Timeout"); ?></td>
617
                                <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>
618
                                <?=gettext("When this is enabled, clients will be disconnected after the amount of time retrieved from the RADIUS Session-Timeout attribute."); ?></td>
619
                        </tr>
620

    
621
                        <tr>
622
                                <td class="vncell" valign="top"><?=gettext("Type"); ?></td>
623
                                <td class="vtable"><select name="radiusvendor" id="radiusvendor">
624
                                <option><?=gettext("default"); ?></option>
625
                                <?php
626
                                $radiusvendors = array("cisco");
627
                                foreach ($radiusvendors as $radiusvendor){
628
                                        if ($pconfig['radiusvendor'] == $radiusvendor)
629
                                                echo "<option selected value=\"$radiusvendor\">$radiusvendor</option>\n";
630
                                        else
631
                                                echo "<option value=\"$radiusvendor\">$radiusvendor</option>\n";
632
                                }
633
                                ?></select><br>
634
                                <?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 " .
635
                                "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."),
636
                                        $g['product_name']);?></td>
637
                        </tr>
638
                </table>
639
        </tr>
640
    <tr>
641
        <td class="vncell" valign="top"><?=gettext("MAC address format"); ?></td>
642
        <td class="vtable">
643
        <select name="radmac_format" id="radmac_format">
644
        <option><?=gettext("default"); ?></option>
645
        <?php
646
        $macformats = array(gettext("singledash"),gettext("ietf"),gettext("cisco"),gettext("unformatted"));
647
        foreach ($macformats as $macformat) {
648
            if ($pconfig['radmac_format'] == $macformat)
649
                echo "<option selected value=\"$macformat\">$macformat</option>\n";
650
            else
651
                echo "<option value=\"$macformat\">$macformat</option>\n";
652
        }
653
        ?>
654
        </select></br>
655
        <?=gettext("This option changes the MAC address format used in the whole RADIUS system. Change this if you also"); ?>
656
        <?=gettext("need to change the username format for RADIUS MAC authentication."); ?><br>
657
        <?=gettext("default:"); ?> 00:11:22:33:44:55<br>
658
        <?=gettext("singledash:"); ?> 001122-334455<br>
659
        <?=gettext("ietf:"); ?> 00-11-22-33-44-55<br>
660
        <?=gettext("cisco:"); ?> 0011.2233.4455<br>
661
        <?=gettext("unformatted:"); ?> 001122334455
662
    </tr>
663
        <tr>
664
      <td valign="top" class="vncell"><?=gettext("HTTPS login"); ?></td>
665
      <td class="vtable">
666
        <input name="httpslogin_enable" type="checkbox" class="formfld" id="httpslogin_enable" value="yes" <?php if($pconfig['httpslogin_enable']) echo "checked"; ?>>
667
        <strong><?=gettext("Enable HTTPS login"); ?></strong><br>
668
    <?=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>
669
          </tr>
670
        <tr>
671
      <td valign="top" class="vncell"><?=gettext("HTTPS server name"); ?> </td>
672
      <td class="vtable">
673
        <input name="httpsname" type="text" class="formfld unknown" id="httpsname" size="30" value="<?=htmlspecialchars($pconfig['httpsname']);?>"><br>
674
        <?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>
675
          </tr>
676
        <tr>
677
      <td valign="top" class="vncell"><?=gettext("HTTPS certificate"); ?></td>
678
      <td class="vtable">
679
        <textarea name="cert" cols="65" rows="7" id="cert" class="formpre"><?=htmlspecialchars($pconfig['cert']);?></textarea>
680
        <br>
681
    <?=gettext("Paste a signed certificate in X.509 PEM format here."); ?></td>
682
          </tr>
683
        <tr>
684
      <td valign="top" class="vncell"><?=gettext("HTTPS private key"); ?></td>
685
      <td class="vtable">
686
        <textarea name="key" cols="65" rows="7" id="key" class="formpre"><?=htmlspecialchars($pconfig['key']);?></textarea>
687
        <br>
688
    <?=gettext("Paste an RSA private key in PEM format here."); ?></td>
689
          </tr>
690
        <tr>
691
      <td valign="top" class="vncell"><?=gettext("HTTPS intermediate certificate"); ?></td>
692
      <td class="vtable">
693
        <textarea name="cacert" cols="65" rows="7" id="cacert" class="formpre"><?=htmlspecialchars($pconfig['cacert']);?></textarea>
694
        <br>
695
    <?=gettext("Paste a certificate in X.509 PEM format here."); ?></td>
696
          </tr>
697
        <tr>
698
          <td width="22%" valign="top" class="vncellreq"><?=gettext("Portal page contents"); ?></td>
699
          <td width="78%" class="vtable">
700
                <?=$mandfldhtml;?><input type="file" name="htmlfile" class="formfld file" id="htmlfile"><br>
701
                <?php if ($config['captiveportal']['page']['htmltext']): ?>
702
                <a href="?act=viewhtml" target="_blank"><?=gettext("View current page"); ?></a>
703
                  <br>
704
                  <br>
705
                <?php endif; ?>
706
                        <?php
707
                                printf(
708
                                        gettext('Upload an HTML/PHP file for the portal page here (leave blank to keep the current one). ' .
709
                                                        '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. ' .
710
                                                        'Include the %5$s and %6$s and/or %7$s input fields if authentication is enabled, otherwise it will always fail.'),
711
                                        "&quot;{$PORTAL_ACTION}&quot;",
712
                                        "name=&quot;accept&quot;",
713
                                        "name=&quot;redirurl&quot;",
714
                                        "value=&quot;{$PORTAL_REDIRURL}&quot;",
715
                                        "&quot;auth_user&quot;",
716
                                        "&quot;auth_pass&quot;",
717
                                        "&quot;auth_voucher&quot;");
718
                        ?>
719
                        <?=gettext("Example code for the form:"); ?><br>
720
                  <br>
721
                  <tt>&lt;form method=&quot;post&quot; action=&quot;$PORTAL_ACTION$&quot;&gt;<br>
722
                  &nbsp;&nbsp;&nbsp;&lt;input name=&quot;auth_user&quot; type=&quot;text&quot;&gt;<br>
723
                  &nbsp;&nbsp;&nbsp;&lt;input name=&quot;auth_pass&quot; type=&quot;password&quot;&gt;<br>
724
                  &nbsp;&nbsp;&nbsp;&lt;input name=&quot;auth_voucher&quot; type=&quot;text&quot;&gt;<br>
725
                  &nbsp;&nbsp;&nbsp;&lt;input name=&quot;redirurl&quot; type=&quot;hidden&quot; value=&quot;$PORTAL_REDIRURL$&quot;&gt;<br>
726
&nbsp;&nbsp;&nbsp;&lt;input name=&quot;accept&quot; type=&quot;submit&quot; value=&quot;Continue&quot;&gt;<br>
727
                  &lt;/form&gt;</tt></td>
728
        </tr>
729
        <tr>
730
          <td width="22%" valign="top" class="vncell"><?=gettext("Authentication"); ?><br>
731
                <?=gettext("error page"); ?><br>
732
                <?=gettext("contents"); ?></td>
733
          <td class="vtable">
734
                <input name="errfile" type="file" class="formfld file" id="errfile"><br>
735
                <?php if ($config['captiveportal']['page']['errtext']): ?>
736
                <a href="?act=viewerrhtml" target="_blank"><?=gettext("View current page"); ?></a>
737
                  <br>
738
                  <br>
739
                <?php endif; ?>
740
<?=gettext("The contents of the HTML/PHP file that you upload here are displayed when an authentication error occurs. " .
741
"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>
742
        </tr>
743
        <tr>
744
          <td width="22%" valign="top" class="vncell"><?=gettext("Logout"); ?><br>
745
                <?=gettext("page"); ?><br>
746
                <?=gettext("contents"); ?></td>
747
          <td class="vtable">
748
                <input name="logoutfile" type="file" class="formfld file" id="logoutfile"><br>
749
                <?php if ($config['captiveportal']['page']['logouttext']): ?>
750
                <a href="?act=viewlogouthtml" 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 on authentication success when the logout popup is enabled."); ?></td>
755
        </tr>
756
        <tr>
757
          <td width="22%" valign="top">&nbsp;</td>
758
          <td width="78%">
759
                <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" onClick="enable_change(true)">
760
          </td>
761
        </tr>
762
        <tr>
763
          <td width="22%" valign="top">&nbsp;</td>
764
          <td width="78%"><span class="vexpl"><span class="red"><strong><?=gettext("Note:"); ?><br>
765
                </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>
766
        </tr>
767
  </table>
768
  </td>
769
  </tr>
770
  </table>
771
</form>
772
<script language="JavaScript">
773
<!--
774
enable_change(false);
775
//-->
776
</script>
777
<?php include("fend.inc"); ?>
778
</body>
779
</html>
780