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='color.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('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
;
72 E('_NC_BridgeLAN').disabled
= !a
;
74 var bridge
= E('_NC_BridgeLAN');
75 if(nvram
.lan_ifname
.length
< 1)
76 bridge
.options
[0].disabled
=true;
77 if(nvram
.lan1_ifname
.length
< 1)
78 bridge
.options
[1].disabled
=true;
79 if(nvram
.lan2_ifname
.length
< 1)
80 bridge
.options
[2].disabled
=true;
81 if(nvram
.lan3_ifname
.length
< 1)
82 bridge
.options
[3].disabled
=true;
84 if ( (E('_f_NC_ForcedRedirect').checked
) && (!v_length('_NC_HomePage', quiet
, 1, 255))) return 0;
85 if (!v_length('_NC_GatewayName', quiet
, 1, 255)) return 0;
86 if ( (E('_NC_IdleTimeout').value
!= '0') && (!v_range('_NC_IdleTimeout', quiet
, 300))) return 0;
92 if (verifyFields(null, 0)==0) return;
94 fom
.NC_enable
.value
= E('_f_NC_enable').checked
? 1 : 0;
95 fom
.NC_ForcedRedirect
.value
= E('_f_NC_ForcedRedirect').checked
? 1 : 0;
97 // blank spaces with commas
98 e
= E('_NC_ExcludePorts');
99 e
.value
= e
.value
.replace(/\,+/g, ' ');
101 e
= E('_NC_IncludePorts');
102 e
.value
= e
.value
.replace(/\,+/g, ' ');
104 e
= E('_NC_AllowedWebHosts');
105 e
.value
= e
.value
.replace(/\,+/g, ' ');
107 e
= E('_NC_MACWhiteList');
108 e
.value
= e
.value
.replace(/\,+/g, ' ');
110 fields
.disableAll(E('upload-section'), 1);
111 if (fom
.NC_enable
.value
== 0) {
112 fom
._service
.value
= 'splashd-stop';
115 fom
._service
.value
= 'splashd-restart';
117 form
.submit('_fom', 1);
126 <body onLoad=
"init()">
127 <table id='container' cellspacing=
0>
128 <tr><td colspan=
2 id='header'
>
129 <div class='title'
>Tomato
</div>
130 <div class='version'
>Version <%
version(); %></div>
132 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
134 <div id='ident'
><%
ident(); %></div>
135 <div class='section-title'
>Captive Portal Management
</div>
136 <div class='section' id='config-section'
>
137 <form id='_fom' method='post' action='tomato.cgi'
>
138 <input type='hidden' name='_nextpage' value='splashd.asp'
>
139 <input type='hidden' name='_service' value='splashd-restart'
>
140 <input type='hidden' name='NC_enable'
>
141 <input type='hidden' name='NC_ForcedRedirect'
>
142 <script type='text/javascript'
>
143 createFieldTable('', [
144 { title
: 'Enable Function', name
: 'f_NC_enable', type
: 'checkbox', value
: nvram
.NC_enable
== '1' },
145 { title
: 'Interface', multi
: [
146 { name
: 'NC_BridgeLAN', type
: 'select', options
: [
147 ['br0','LAN (br0)*'],
148 ['br1','LAN1 (br1)'],
149 ['br2','LAN2 (br2)'],
151 ], value
: nvram
.NC_BridgeLAN
, suffix
: ' <small>* default</small> ' } ] },
152 { title
: 'Gateway Name', name
: 'NC_GatewayName', type
: 'text', maxlen
: 255, size
: 34, value
: nvram
.NC_GatewayName
},
153 { title
: 'Captive Site Forwarding', name
: 'f_NC_ForcedRedirect', type
: 'checkbox', value
: (nvram
.NC_ForcedRedirect
== '1') },
154 { title
: 'Home Page', name
: 'NC_HomePage', type
: 'text', maxlen
: 255, size
: 34, value
: nvram
.NC_HomePage
},
155 { title
: 'Welcome html Path', name
: 'NC_DocumentRoot', type
: 'text', maxlen
: 255, size
: 20, value
: nvram
.NC_DocumentRoot
, suffix
: '<span> /splash.html</span>' },
156 { title
: 'Logged Timeout', name
: 'NC_LoginTimeout', type
: 'text', maxlen
: 8, size
: 4, value
: nvram
.NC_LoginTimeout
, suffix
: ' <small>seconds</small>' },
157 { title
: 'Idle Timeout', name
: 'NC_IdleTimeout', type
: 'text', maxlen
: 8, size
: 4, value
: nvram
.NC_IdleTimeout
, suffix
: ' <small>seconds (0 - unlimited)</small>' },
158 { title
: 'Max Missed ARP', name
: 'NC_MaxMissedARP', type
: 'text', maxlen
: 10, size
: 2, value
: nvram
.NC_MaxMissedARP
},
160 { title
: 'Log Info Level', name
: 'NC_Verbosity', type
: 'text', maxlen
: 10, size
: 2, value
: nvram
.NC_Verbosity
},
161 { title
: 'Gateway Port', name
: 'NC_GatewayPort', type
: 'text', maxlen
: 10, size
: 7, value
: fixPort(nvram
.NC_GatewayPort
, 5280) },
162 { title
: 'Excluded Ports to be redirected', name
: 'NC_ExcludePorts', type
: 'text', maxlen
: 255, size
: 34, value
: nvram
.NC_ExcludePorts
},
163 { title
: 'Included Ports to be redirected', name
: 'NC_IncludePorts', type
: 'text', maxlen
: 255, size
: 34, value
: nvram
.NC_IncludePorts
},
164 { title
: 'URL Excluded off Captive Portal', name
: 'NC_AllowedWebHosts', type
: 'text', maxlen
: 255, size
: 34, value
: nvram
.NC_AllowedWebHosts
},
165 { title
: 'MAC Address Whitelist', name
: 'NC_MACWhiteList', type
: 'text', maxlen
: 255, size
: 34, value
: nvram
.NC_MACWhiteList
}
171 <div class='section-title'
>Customized Splash File Path
</div>
172 <div class='section' id='upload-section'
>
173 <form id='upload-form' method='post' action='uploadsplash.cgi?_http_id=<%
nv(http_id
); %>' encType='multipart/form-data'
>
174 <input type='file' size='
40' id='upload-name' name='upload_name'
>
175 <input type='button' name='f_upload_button' id='upload-button' value='Upload' onclick='uploadButton()'
>
180 <span style='color:blue'
>
181 <b>Captive Portal. User Guide.
</b><br>
183 <b>*- Enable function:
</b> When you tick and save the router will show a Welcome Banner when a computer access the Internet.
<br>
184 <b>*- Interface:
</b> Select one of the bridges on which Captive Portal will listen.
<br>
185 <b>*- Gateway name:
</b> The name of the Gateway appearing in the welcome banner
<br>
186 <b>*- Captive Site Forwarding:
</b> When active, the 'Home Page' (read next line) will appear after you Agree in Welcome Banner.
<br>
187 <b>*- Home page:
</b> The URL that will appear after you Agree the Welcome Banner.
<br>
188 <b>*- Welcome html Path:
</b> The location where the Welcome banner is located
<br>
189 <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>
190 <b>*- Idle Timeout:
</b> Expired time where you can't access the device again.Default value=
0.
<br>
191 <b>*- Max Missed ARP:
</b> Number of lost ARP before considering the client has leaved the connection. Default =
5<br>
192 <b>*- Log Info Level:
</b> Messages from this module stored internally for better trace. Level
0=Silent,
10=Parrot,
2=Default.
<br>
193 <b>*- Gateway Port:
</b> Port to be used by the Captive Portal for page redirection. Port
1 to
65534. Default=
5280.
<br>
194 <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>
195 <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>
196 <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>
197 <b>*- Customized Splash File Path:
</b> Here you can upload your personal Welcome banner that will overwrite the default one.
<br><br>
200 <span style='color:red'
>
201 <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>
205 <tr><td id='footer' colspan=
2>
207 <span id='footer-msg'
></span>
208 <input type='button' value='Save' id='save-button' onclick='save()'
>
209 <input type='button' value='Cancel' id='cancel-button' onclick='javascript:reloadPage();'
>
214 <script type='text/javascript'
>verifyFields(null, 1);</script>