usbmodeswitch: Updated to v.1.2.6 from shibby's branch.
[tomato.git] / release / src / router / www / splashd.asp
blobd5a7fa09ee5def61ee2f9b649a1b52eab401f473
1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0//EN'>
2 <!--
3 Tomato GUI
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.
12 -->
13 <html>
14 <head>
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'>
22 textarea {
23 width: 98%;
24 height: 15em;
26 </style>
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"); %>
29 function fix(name)
31 var i;
32 if (((i = name.lastIndexOf('/')) > 0) || ((i = name.lastIndexOf('\\')) > 0))
33 name = name.substring(i + 1, name.length);
34 return name;
37 function uploadButton()
39 var fom;
40 var name;
41 var i;
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".');
46 return;
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;
72 /* VLAN-BEGIN */
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;
84 /* VLAN-END */
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;
89 return 1;
92 function save()
94 if (verifyFields(null, 0)==0) return;
95 var fom = E('_fom');
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';
116 else {
117 fom._service.value = 'splashd-restart';
119 form.submit('_fom', 1);
122 function init()
125 </script>
126 </head>
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>
133 </td></tr>
134 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
135 <td id='content'>
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') },
148 /* VLAN-BEGIN */
149 { title: 'Interface', multi: [
150 { name: 'NC_BridgeLAN', type: 'select', options: [
151 ['br0','LAN (br0)*'],
152 ['br1','LAN1 (br1)'],
153 ['br2','LAN2 (br2)'],
154 ['br3','LAN3 (br3)']
155 ], value: nvram.NC_BridgeLAN, suffix: ' <small>* default</small> ' } ] },
156 /* VLAN-END */
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>&nbsp;/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 },
163 null,
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 }
171 </script>
172 </form>
173 </div>
174 <br>
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()'>
180 <br>
181 </form>
182 </div>
183 <br>
184 <ul>
185 <span style='color:blue'>
186 <b>Captive Portal User Guide.</b><br>
187 </span>
188 <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>
190 /* VLAN-BEGIN */
191 <li><b> Interface:</b> - Select one of the LAN bridges on which the Captive Portal will Pop-up.<br>
192 /* VLAN-END */
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>
210 </span>
211 <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.
214 <br>
215 </span>
216 </ul>
217 <br>
218 </td></tr>
219 <tr><td id='footer' colspan=2>
220 <form>
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();'>
224 </form>
225 </div>
226 </td></tr>
227 </table>
228 <script type='text/javascript'>verifyFields(null, 1);</script>
229 </body>
230 </html>