1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML
4.0//EN'
>
4 Copyright (C) 2006-2008 Jonathan Zarate
5 http://www.polarcloud.com/tomato/
7 Copyright (C) 2011 Ofer Chen (Roadkill), Vicente Soriano (Victek)
8 Adapted & Modified from Dual WAN Tomato Firmware.
10 For use with Tomato Firmware only.
11 No part of this file may be used without permission.
15 <meta http-equiv='content-type' content='text/html;charset=utf-
8'
>
16 <meta name='robots' content='noindex,nofollow'
>
17 <title>[<%
ident(); %>] Captive Portal
</title>
18 <link rel='stylesheet' type='text/css' href='tomato.css'
>
19 <link rel='stylesheet' type='text/css' href='<%
nv('web_css'); %>.css'
>
20 <script type='text/javascript' src='tomato.js'
></script>
21 <style type='text/css'
>
27 <script type='text/javascript'
>
28 // <% nvram("NC_enable,NC_Verbosity,NC_GatewayName,NC_GatewayPort,NC_ForcedRedirect,NC_HomePage,NC_DocumentRoot,NC_LoginTimeout,NC_IdleTimeout,NC_MaxMissedARP,NC_ExcludePorts,NC_IncludePorts,NC_AllowedWebHosts,NC_MACWhiteList,NC_BridgeLAN,lan_ifname,lan1_ifname,lan2_ifname,lan3_ifname"); %>
32 if (((i
= name
.lastIndexOf('/')) > 0) || ((i
= name
.lastIndexOf('\\')) > 0))
33 name
= name
.substring(i
+ 1, name
.length
);
37 function uploadButton()
42 name
= fix(E('upload-name').value
);
43 name
= name
.toLowerCase();
44 if ((name
.length
<= 5) || (name
.substring(name
.length
- 5, name
.length
).toLowerCase() != '.html')) {
45 alert('Wrong filename, the correct extension is ".html".');
48 if (!confirm('Upload file ' + name
+ ' to replace the default splash page?')) return;
49 E('upload-button').disabled
= 1;
50 fields
.disableAll(E('config-section'), 1);
51 fields
.disableAll(E('footer'), 1);
52 E('upload-form').submit();
55 function verifyFields(focused
, quiet
)
57 var a
= E('_f_NC_enable').checked
;
59 E('_NC_Verbosity').disabled
= !a
;
60 E('_NC_GatewayName').disabled
= !a
;
61 E('_NC_GatewayPort').disabled
= !a
;
62 E('_f_NC_ForcedRedirect').disabled
= !a
;
63 E('_NC_HomePage').disabled
= !a
;
64 E('_NC_DocumentRoot').disabled
= !a
;
65 E('_NC_LoginTimeout').disabled
= !a
;
66 E('_NC_IdleTimeout').disabled
= !a
;
67 E('_NC_MaxMissedARP').disabled
= !a
;
68 E('_NC_ExcludePorts').disabled
= !a
;
69 E('_NC_IncludePorts').disabled
= !a
;
70 E('_NC_AllowedWebHosts').disabled
= !a
;
71 E('_NC_MACWhiteList').disabled
= !a
;
73 E('_NC_BridgeLAN').disabled
= !a
;
75 var bridge
= E('_NC_BridgeLAN');
76 if(nvram
.lan_ifname
.length
< 1)
77 bridge
.options
[0].disabled
=true;
78 if(nvram
.lan1_ifname
.length
< 1)
79 bridge
.options
[1].disabled
=true;
80 if(nvram
.lan2_ifname
.length
< 1)
81 bridge
.options
[2].disabled
=true;
82 if(nvram
.lan3_ifname
.length
< 1)
83 bridge
.options
[3].disabled
=true;
86 if ( (E('_f_NC_ForcedRedirect').checked
) && (!v_length('_NC_HomePage', quiet
, 1, 255))) return 0;
87 if (!v_length('_NC_GatewayName', quiet
, 1, 255)) return 0;
88 if ( (E('_NC_IdleTimeout').value
!= '0') && (!v_range('_NC_IdleTimeout', quiet
, 300))) return 0;
94 if (verifyFields(null, 0)==0) return;
96 fom
.NC_enable
.value
= E('_f_NC_enable').checked
? 1 : 0;
97 fom
.NC_ForcedRedirect
.value
= E('_f_NC_ForcedRedirect').checked
? 1 : 0;
99 // blank spaces with commas
100 e
= E('_NC_ExcludePorts');
101 e
.value
= e
.value
.replace(/\,+/g, ' ');
103 e
= E('_NC_IncludePorts');
104 e
.value
= e
.value
.replace(/\,+/g, ' ');
106 e
= E('_NC_AllowedWebHosts');
107 e
.value
= e
.value
.replace(/\,+/g, ' ');
109 e
= E('_NC_MACWhiteList');
110 e
.value
= e
.value
.replace(/\,+/g, ' ');
112 fields
.disableAll(E('upload-section'), 1);
113 if (fom
.NC_enable
.value
== 0) {
114 fom
._service
.value
= 'splashd-stop';
117 fom
._service
.value
= 'splashd-restart';
119 form
.submit('_fom', 1);
128 <body onLoad=
"init()">
129 <table id='container' cellspacing=
0>
130 <tr><td colspan=
2 id='header'
>
131 <div class='title'
>Tomato
</div>
132 <div class='version'
>Version <%
version(); %></div>
134 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
136 <div id='ident'
><%
ident(); %></div>
137 <div class='section-title'
>Captive Portal Management
</div>
138 <div class='section' id='config-section'
>
139 <form id='_fom' method='post' action='tomato.cgi'
>
140 <input type='hidden' name='_nextpage' value='splashd.asp'
>
141 <input type='hidden' name='_service' value='splashd-restart'
>
142 <input type='hidden' name='NC_enable'
>
143 <input type='hidden' name='NC_ForcedRedirect'
>
144 <script type='text/javascript'
>
145 createFieldTable('', [
146 { title
: 'Enable Function', name
: 'f_NC_enable', type
: 'checkbox', value
: nvram
.NC_enable
== '1' },
147 { title
: 'Captive Site Forwarding', name
: 'f_NC_ForcedRedirect', type
: 'checkbox', value
: (nvram
.NC_ForcedRedirect
== '1') },
149 { title
: 'Interface', multi
: [
150 { name
: 'NC_BridgeLAN', type
: 'select', options
: [
151 ['br0','LAN (br0)*'],
152 ['br1','LAN1 (br1)'],
153 ['br2','LAN2 (br2)'],
155 ], value
: nvram
.NC_BridgeLAN
, suffix
: ' <small>* default</small> ' } ] },
157 { title
: 'Gateway Name', name
: 'NC_GatewayName', type
: 'text', maxlen
: 255, size
: 34, value
: nvram
.NC_GatewayName
},
158 { title
: 'Home Page', name
: 'NC_HomePage', type
: 'text', maxlen
: 255, size
: 34, value
: nvram
.NC_HomePage
},
159 { title
: 'Welcome html Path', name
: 'NC_DocumentRoot', type
: 'text', maxlen
: 255, size
: 20, value
: nvram
.NC_DocumentRoot
, suffix
: '<span> /splash.html</span>' },
160 { title
: 'Login Timeout', name
: 'NC_LoginTimeout', type
: 'text', maxlen
: 8, size
: 4, value
: nvram
.NC_LoginTimeout
, suffix
: ' <small>seconds</small>' },
161 { title
: 'Idle Timeout', name
: 'NC_IdleTimeout', type
: 'text', maxlen
: 8, size
: 4, value
: nvram
.NC_IdleTimeout
, suffix
: ' <small>seconds (0 - unlimited)</small>' },
162 { title
: 'Max Missed ARP', name
: 'NC_MaxMissedARP', type
: 'text', maxlen
: 10, size
: 2, value
: nvram
.NC_MaxMissedARP
},
164 { title
: 'Log Info Level', name
: 'NC_Verbosity', type
: 'text', maxlen
: 10, size
: 2, value
: nvram
.NC_Verbosity
},
165 { title
: 'Gateway Port', name
: 'NC_GatewayPort', type
: 'text', maxlen
: 10, size
: 7, value
: fixPort(nvram
.NC_GatewayPort
, 5280) },
166 { title
: 'Excluded Ports to be redirected', name
: 'NC_ExcludePorts', type
: 'text', maxlen
: 255, size
: 34, value
: nvram
.NC_ExcludePorts
},
167 { title
: 'Included Ports to be redirected', name
: 'NC_IncludePorts', type
: 'text', maxlen
: 255, size
: 34, value
: nvram
.NC_IncludePorts
},
168 { title
: 'Excluded URLs', name
: 'NC_AllowedWebHosts', type
: 'text', maxlen
: 255, size
: 34, value
: nvram
.NC_AllowedWebHosts
},
169 { title
: 'MAC Address Whitelist', name
: 'NC_MACWhiteList', type
: 'text', maxlen
: 255, size
: 34, value
: nvram
.NC_MACWhiteList
}
175 <div class='section-title'
>Customized Splash File Path
</div>
176 <div class='section' id='upload-section'
>
177 <form id='upload-form' method='post' action='uploadsplash.cgi?_http_id=<%
nv(http_id
); %>' encType='multipart/form-data'
>
178 <input type='file' size='
40' id='upload-name' name='upload_name'
>
179 <input type='button' name='f_upload_button' id='upload-button' value='Upload' onclick='uploadButton()'
>
185 <span style='color:blue'
>
186 <b>Captive Portal User Guide.
</b><br>
189 <li><b> Enable function:
</b> When you tick and save the router will show a Welcome Banner when a computer access the Internet.
<br>
191 <li><b> Interface:
</b> - Select one of the LAN bridges on which the Captive Portal will Pop-up.
<br>
193 <li><b> Gateway name
</b> - The name of the Gateway appearing in the welcome banner
<br>
194 <li><b> Gateway port
</b> - The Gateway Port number. Default=
5280.
<br>
195 <li><b> Captive Site Forwarding
</b> - When active, the 'Home Page' wrote in the next field will appear after you click
"Agree" in the Welcome banner.
<br>
196 <li><b> Home page
</b> - The URL for the 'Home Page' mentioned above is show.
<br>
197 <li><b> Welcome html Path
</b> - The stored Welcome banner location
<br>
198 <li><b> Login Timeout
</b> - The client can use the internet until this time expires. Default=
1 Hour.
<br>
199 <li><b> Idle Timeout
</b> - How often the ARP cache will be checked (seconds). Default=
0.
<br>
200 <li><b> Max Missed ARP
</b> - Number of lost ARP before considering the client has leaved the connection. Default =
5<br>
201 <li><b> Log Info Level
</b> - Verbosity level for log messages from this module, Level
0=Silent,
10=Verbose, (Default=
0).
<br>
203 <li><b> Included ports
</b> - TCP ports to allow access to after login, all others will be denied.
<br>
204 <li><b> Excluded ports
</b> - TCP ports to denied access to after login, all others will be allowed.
<br>
205 Leave a blank space between each port number. Use only one of these two options to avoid conflicts.
<br>
207 <li><b> Excluded URLs
</b> - URLs that can be accessed without the Welcome banner screen appearance. When you set allowed url's also leave a blank space between each url. i.e; http://www.google.com http://www.google.es
<br>
208 <li><b> MAC address whitelist
</b> - MAC addresses excluded from the portal (i.e; Your PC). Leave a blank space between each MAC Address, i.e;
11:
22:
33:
44:
55:
66 11:
22:
33:
44:
55:
67<br>
209 <li><b> Customized Splash File Path
</b> - Here you can upload your personal Welcome banner that will overwrite the default one.
<br><br>
212 <span style='color:red'
>
213 <b> Note:
</b> When the client's lease has expired, he must enter the Splash page again to get a new lease. No warning is given, therefore you may wish to give a long lease time to avoid problems.
219 <tr><td id='footer' colspan=
2>
221 <span id='footer-msg'
></span>
222 <input type='button' value='Save' id='save-button' onclick='save()'
>
223 <input type='button' value='Cancel' id='cancel-button' onclick='javascript:reloadPage();'
>
228 <script type='text/javascript'
>verifyFields(null, 1);</script>