MiniDLNA update: 1.0.19.1 to 1.0.20
[tomato.git] / release / src / router / www / new-splashd.asp
bloba57bafac34973067bb6456ec93f5dd28adf5e1a6
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(); %>] New: 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"); %>
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('Are you sure the file' + name + 'must be uploaded to the device?')) 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 if ( (E('_f_NC_ForcedRedirect').checked) && (!v_length('_NC_HomePage', quiet, 1, 255))) return 0;
74 if (!v_length('_NC_GatewayName', quiet, 1, 255)) return 0;
75 if ( (E('_NC_IdleTimeout').value != '0') && (!v_range('_NC_IdleTimeout', quiet, 300))) return 0;
76 return 1;
79 function save()
81 if (verifyFields(null, 0)==0) return;
82 var fom = E('_fom');
83 fom.NC_enable.value = E('_f_NC_enable').checked ? 1 : 0;
84 fom.NC_ForcedRedirect.value = E('_f_NC_ForcedRedirect').checked ? 1 : 0;
86 // blank spaces with commas
87 e = E('_NC_ExcludePorts');
88 e.value = e.value.replace(/\,+/g, ' ');
90 e = E('_NC_IncludePorts');
91 e.value = e.value.replace(/\,+/g, ' ');
93 e = E('_NC_AllowedWebHosts');
94 e.value = e.value.replace(/\,+/g, ' ');
96 e = E('_NC_MACWhiteList');
97 e.value = e.value.replace(/\,+/g, ' ');
99 fields.disableAll(E('upload-section'), 1);
100 if (fom.NC_enable.value == 0) {
101 fom._service.value = 'splashd-stop';
103 else {
104 fom._service.value = 'splashd-restart';
106 form.submit('_fom', 1);
109 function init()
112 </script>
113 </head>
115 <body onLoad="init()">
116 <table id='container' cellspacing=0>
117 <tr><td colspan=2 id='header'>
118 <div class='title'>Tomato</div>
119 <div class='version'>Version <% version(); %></div>
120 </td></tr>
121 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
122 <td id='content'>
123 <div id='ident'><% ident(); %></div>
124 <div class='section-title'>Captive Portal Management</div>
125 <div class='section' id='config-section'>
126 <form id='_fom' method='post' action='tomato.cgi'>
127 <input type='hidden' name='_nextpage' value='new-splashd.asp'>
128 <input type='hidden' name='_service' value='splashd-restart'>
129 <input type='hidden' name='NC_enable'>
130 <input type='hidden' name='NC_ForcedRedirect'>
131 <script type='text/javascript'>
132 createFieldTable('', [
133 { title: 'Enable Function', name: 'f_NC_enable', type: 'checkbox', value: nvram.NC_enable == '1' },
134 { title: 'Gateway Name', name: 'NC_GatewayName', type: 'text', maxlen: 255, size: 34, value: nvram.NC_GatewayName },
135 { title: 'Captive Site Forwarding', name: 'f_NC_ForcedRedirect', type: 'checkbox', value: (nvram.NC_ForcedRedirect == '1') },
136 { title: 'Home Page', name: 'NC_HomePage', type: 'text', maxlen: 255, size: 34, value: nvram.NC_HomePage },
137 { title: 'Welcome html Path', name: 'NC_DocumentRoot', type: 'text', maxlen: 255, size: 20, value: nvram.NC_DocumentRoot, suffix: '<span>&nbsp;/splash.html</span>' },
138 { title: 'Logged Timeout', name: 'NC_LoginTimeout', type: 'text', maxlen: 8, size: 4, value: nvram.NC_LoginTimeout },
139 { title: 'Idle Timeout', name: 'NC_IdleTimeout', type: 'text', maxlen: 8, size: 4, value: nvram.NC_IdleTimeout },
140 { title: 'Max Missed ARP', name: 'NC_MaxMissedARP', type: 'text', maxlen: 10, size: 2, value: nvram.NC_MaxMissedARP },
141 null,
142 { title: 'Log Info Level', name: 'NC_Verbosity', type: 'text', maxlen: 10, size: 2, value: nvram.NC_Verbosity },
143 { title: 'Gateway Port', name: 'NC_GatewayPort', type: 'text', maxlen: 10, size: 7, value: fixPort(nvram.NC_GatewayPort, 5280) },
144 { title: 'Excluded Ports to be redirected', name: 'NC_ExcludePorts', type: 'text', maxlen: 255, size: 34, value: nvram.NC_ExcludePorts },
145 { title: 'Included Ports to be redirected', name: 'NC_IncludePorts', type: 'text', maxlen: 255, size: 34, value: nvram.NC_IncludePorts },
146 { title: 'URL Excluded off Captive Portal', name: 'NC_AllowedWebHosts', type: 'text', maxlen: 255, size: 34, value: nvram.NC_AllowedWebHosts },
147 { title: 'MAC Address Whitelist', name: 'NC_MACWhiteList', type: 'text', maxlen: 255, size: 34, value: nvram.NC_MACWhiteList }
149 </script>
150 </form>
151 </div>
152 <br>
153 <div class='section-title'>Customized Splash File Path</div>
154 <div class='section' id='upload-section'>
155 <form id='upload-form' method='post' action='uploadsplash.cgi?_http_id=<% nv(http_id); %>' encType='multipart/form-data'>
156 <input type='file' size='40' id='upload-name' name='upload_name'>
157 <input type='button' name='f_upload_button' id='upload-button' value='Upload' onclick='uploadButton()'>
158 <br>
159 </form>
160 </div>
161 <hr>
162 <span style='color:blue'>
163 <b>Captive Portal. User Guide.</b><br>
164 <br>
165 <b>*- Enable function:</b> When you tick and save the router will show a Welcome Banner when a computer access the Internet.<br>
166 <b>*- Gateway name:</b> The name of the Gateway appearing in the welcome banner<br>
167 <b>*- Captive Site Forwarding:</b> When active, the 'Home Page' (read next line) will appear after you Agree in Welcome Banner.<br>
168 <b>*- Home page:</b> The URL that will appear after you Agree the Welcome Banner.<br>
169 <b>*- Welcome html Path:</b> The location where the Welcome banner is located<br>
170 <b>*- Logged Timeout:</b> During this period of time no Welcome banner will appear when you access to the device. Default=3600 sec.(1 Hour).<br>
171 <b>*- Idle Timeout:</b> Expired time where you can't access the device again.Default value=0.<br>
172 <b>*- Max Missed ARP:</b> Number of lost ARP before considering the client has leaved the connection. Default = 5<br>
173 <b>*- Log Info Level:</b> Messages from this module stored internally for better trace. Level 0=Silent, 10=Parrot, 2=Default.<br>
174 <b>*- Gateway Port:</b> Port to be used by the Captive Portal for page redirection. Port 1 to 65534. Default=5280.<br>
175 <b>*- Excluded/Included ports to be redirected:</b> When setting any port (included or excluded) leave a blank space between each port number, i.e; 25 110 4662 4672. Use prefereable one of the two option to avoid conflicts.<br>
176 <b>*- URL excluded off the portal:</b> URL that will be accessed without Welcome banner screen appearing. 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>
177 <b>*- MAC address whitelist:</b> MAC addresses excluded of the feature. Leave a blank space between each MAC Address, i.e; 11:22:33:44:55:66 11:22:33:44:55:67<br>
178 <b>*- Customized Splash File Path:</b> Here you can upload your personal Welcome banner that will overwrite the default one.<br><br>
179 </span>
180 <br>
181 <span style='color:red'>
182 <b> Note: If Login Time is expired you should re-enter again into the splash page to get a new lease period. Be aware, there is no notice about expired period so, you can loss Internet Access.</b><br>
183 </span>
184 <br>
185 </td></tr>
186 <tr><td id='footer' colspan=2>
187 <form>
188 <span id='footer-msg'></span>
189 <input type='button' value='Save' id='save-button' onclick='save()'>
190 <input type='button' value='Cancel' id='cancel-button' onclick='javascript:reloadPage();'>
191 </form>
192 </div>
193 </td></tr>
194 </table>
195 <script type='text/javascript'>verifyFields(null, 1);</script>
196 </body>
197 </html>