RSA Keylength to 1024
[tomato.git] / release / src / router / www / splashd.asp
blob6eed996fe48c6a58079dca2b3ba65769ed683e74
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'>
29 // <% 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"); %>
32 function fix(name)
34 var i;
35 if (((i = name.lastIndexOf('/')) > 0) || ((i = name.lastIndexOf('\\')) > 0))
36 name = name.substring(i + 1, name.length);
37 return name;
40 function uploadButton()
42 var fom;
43 var name;
44 var i;
45 name = fix(E('upload-name').value);
46 name = name.toLowerCase();
47 if ((name.length <= 5) || (name.substring(name.length - 5, name.length).toLowerCase() != '.html')) {
48 alert('Wrong filename, the correct extension is ".html".');
49 return;
51 if (!confirm('Upload file ' + name + ' to replace the default splash page?')) return;
52 E('upload-button').disabled = 1;
53 fields.disableAll(E('config-section'), 1);
54 fields.disableAll(E('footer'), 1);
55 E('upload-form').submit();
58 function verifyFields(focused, quiet)
60 var a = E('_f_NC_enable').checked;
62 E('_NC_Verbosity').disabled = !a;
63 E('_NC_GatewayName').disabled = !a;
64 E('_NC_GatewayPort').disabled = !a;
65 E('_f_NC_ForcedRedirect').disabled = !a;
66 E('_NC_HomePage').disabled = !a;
67 E('_NC_DocumentRoot').disabled = !a;
68 E('_NC_LoginTimeout').disabled = !a;
69 E('_NC_IdleTimeout').disabled = !a;
70 E('_NC_MaxMissedARP').disabled = !a;
71 E('_NC_ExcludePorts').disabled = !a;
72 E('_NC_IncludePorts').disabled = !a;
73 E('_NC_AllowedWebHosts').disabled = !a;
74 E('_NC_MACWhiteList').disabled = !a;
76 if ( (E('_f_NC_ForcedRedirect').checked) && (!v_length('_NC_HomePage', quiet, 1, 255))) return 0;
77 if (!v_length('_NC_GatewayName', quiet, 1, 255)) return 0;
78 if ( (E('_NC_IdleTimeout').value != '0') && (!v_range('_NC_IdleTimeout', quiet, 300))) return 0;
79 return 1;
82 function save()
84 if (verifyFields(null, 0)==0) return;
85 var fom = E('_fom');
86 fom.NC_enable.value = E('_f_NC_enable').checked ? 1 : 0;
87 fom.NC_ForcedRedirect.value = E('_f_NC_ForcedRedirect').checked ? 1 : 0;
89 // blank spaces with commas
90 e = E('_NC_ExcludePorts');
91 e.value = e.value.replace(/\,+/g, ' ');
93 e = E('_NC_IncludePorts');
94 e.value = e.value.replace(/\,+/g, ' ');
96 e = E('_NC_AllowedWebHosts');
97 e.value = e.value.replace(/\,+/g, ' ');
99 e = E('_NC_MACWhiteList');
100 e.value = e.value.replace(/\,+/g, ' ');
102 fields.disableAll(E('upload-section'), 1);
103 if (fom.NC_enable.value == 0) {
104 fom._service.value = 'splashd-stop';
106 else {
107 fom._service.value = 'splashd-restart';
109 form.submit('_fom', 1);
112 function init()
115 </script>
116 </head>
118 <body onLoad="init()">
119 <table id='container' cellspacing=0>
120 <tr><td colspan=2 id='header'>
121 <div class='title'>Tomato</div>
122 <div class='version'>Version <% version(); %></div>
123 </td></tr>
124 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
125 <td id='content'>
126 <div id='ident'><% ident(); %></div>
127 <div class='section-title'>Captive Portal Management</div>
128 <div class='section' id='config-section'>
129 <form id='_fom' method='post' action='tomato.cgi'>
130 <input type='hidden' name='_nextpage' value='new-splashd.asp'>
131 <input type='hidden' name='_service' value='splashd-restart'>
132 <input type='hidden' name='NC_enable'>
133 <input type='hidden' name='NC_ForcedRedirect'>
134 <script type='text/javascript'>
135 createFieldTable('', [
136 { title: 'Enable', name: 'f_NC_enable', type: 'checkbox', value: nvram.NC_enable == '1' },
137 { title: 'Log Info Level', name: 'NC_Verbosity', type: 'text', maxlen: 10, size: 2, value: nvram.NC_Verbosity },
138 { title: 'Gateway Name', name: 'NC_GatewayName', type: 'text', maxlen: 255, size: 34, value: nvram.NC_GatewayName },
139 { title: 'Gateway Port', indent: 2, name: 'NC_GatewayPort', type: 'text', maxlen: 6, size: 10, value: fixPort(nvram.NC_GatewayPort, 5280) },
140 { title: 'Captive Site Forwarding', name: 'f_NC_ForcedRedirect', type: 'checkbox', value: (nvram.NC_ForcedRedirect == '1') },
141 { title: 'Home Page', indent: 2, name: 'NC_HomePage', type: 'text', maxlen: 255, size: 34, value: nvram.NC_HomePage },
142 { title: 'Welcome HTML Path', name: 'NC_DocumentRoot', type: 'text', maxlen: 255, size: 34, value: nvram.NC_DocumentRoot, suffix: '<span>&nbsp;/splash.html</span>' },
143 { title: 'Login Timeout', name: 'NC_LoginTimeout', type: 'text', maxlen: 8, size: 10, value: nvram.NC_LoginTimeout },
144 { title: 'Max Missed ARP', name: 'NC_MaxMissedARP', type: 'text', maxlen: 10, size: 10, value: nvram.NC_MaxMissedARP },
145 { title: 'Idle Timeout', name: 'NC_IdleTimeout', type: 'text', maxlen: 8, size: 10, value: nvram.NC_IdleTimeout },
146 null,
147 { title: 'Excluded Ports', name: 'NC_ExcludePorts', type: 'text', maxlen: 255, size: 34, value: nvram.NC_ExcludePorts },
148 { title: 'Included Ports', name: 'NC_IncludePorts', type: 'text', maxlen: 255, size: 34, value: nvram.NC_IncludePorts },
149 { title: 'Excluded URLs', name: 'NC_AllowedWebHosts', type: 'text', maxlen: 255, size: 34, value: nvram.NC_AllowedWebHosts },
150 { title: 'MAC Address Whitelist', name: 'NC_MACWhiteList', type: 'text', maxlen: 255, size: 34, value: nvram.NC_MACWhiteList }
152 </script>
153 </form>
154 </div>
155 <br>
156 <div class='section-title'>Customized Splash File Path</div>
157 <div class='section' id='upload-section'>
158 <form id='upload-form' method='post' action='uploadsplash.cgi?_http_id=<% nv(http_id); %>' encType='multipart/form-data'>
159 <input type='file' size='40' id='upload-name' name='upload_name'>
160 <input type='button' name='f_upload_button' id='upload-button' value='Upload' onclick='uploadButton()'>
161 <br>
162 </form>
163 </div>
164 <br>
165 <br>
166 <br>
167 <span style='color:blue'>
168 <b>User Guide</b><br>
169 </span>
170 <br>
171 <ul>
172 <li><b>Enable</b> - The router will show a Welcome banner when a client attempts to access the Internet.<br>
173 <li><b>Log Info Level</b> - Verbosity level for log messages from this module, Level 0=Silent, 10=Verbose, (Default=0).<br>
174 <li><b>Gateway name</b> - The name of the gateway appearing in the Welcome banner.<br>
175 <li><b>Gateway port</b> - The port number of the gateway. Default=5280.<br>
176 <li><b>Captive Site Forwarding</b> - When active, a 'Home Page' will appear after you click "Agree" in the Welcome banner.<br>
177 <li><b>Home Page</b> - The URL for the 'Home Page' mentioned above is located.<br>
178 <li><b>Welcome HTML Path</b> - The location where the Welcome banner is stored.<br>
179 <li><b>Login Timeout</b> - The client can use the internet until this time expires. Default=3600sec.<br>
180 <li><b>Max Missed ARP</b> - No. of times a client can be missing from ARP cache before the connection is closed. Default=5.<br>
181 <li><b>Idle Timeout</b> - How often the ARP cache will be checked (seconds). Default=0.<br>
182 <li><b>Included ports</b> - TCP ports to allow access to after login, all others will be denied.<br>
183 <li><b>Excluded ports</b> - TCP ports to denied access to after login, all others will be allowed.<br>
184 Leave a blank space between each port number. Use only one of these two options to avoid conflicts.<br>
185 <li><b>Excluded URLs</b> - Sites that can be accessed without the Welcome banner appearing.<br>
186 Leave a blank space between each URL.<br>
187 <li><b>MAC address Whitelist</b> - addresses excluded from the portal. Leave a blank space between each MAC address.<br>
188 <li><b>Customized Splash File Path</b> - You may upload a custom Welcome banner that will overwrite the default one.<br><br>
189 <br>
190 <span style='color:red'>
191 <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.
192 <br>
193 </span>
194 </ul>
195 <br>
196 </td></tr>
197 <tr><td id='footer' colspan=2>
198 <form>
199 <span id='footer-msg'></span>
200 <input type='button' value='Save' id='save-button' onclick='save()'>
201 <input type='button' value='Cancel' id='cancel-button' onclick='javascript:reloadPage();'>
202 </form>
203 </div>
204 </td></tr>
205 </table>
206 <script type='text/javascript'>verifyFields(null, 1);</script>
207 </body>
208 </html>