1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML
4.0//EN'
>
4 Copyright (C) 2012 Augusto Bott
5 http://code.google.com/p/tomato-sdhc-vlan/
8 Copyright (C) 2006-2007 Jonathan Zarate
9 http://www.polarcloud.com/tomato/
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(); %>] VPN:PPTP Online
</title>
18 <link rel='stylesheet' type='text/css' href='tomato.css'
>
20 <script type='text/javascript' src='tomato.js'
></script>
21 <style type='text/css'
>
45 <script type='text/javascript'
>
46 // <% nvram(''); %> // http_id
47 // <% pptpd_userol(); %>
53 for (i
= list
.length
- 1; i
>= 0; --i
) {
64 if ((e
= find(pid
)) != null) {
80 function _disconnect(pid
) {
81 form
.submitHidden('/pptpd.cgi', { disconnect
: pid
});
84 function disconnect(a
, pid
) {
86 if ((xob
= new XmlHttp()) == null) {
91 a
.innerHTML
= 'Disconnecting...';
93 xob
.onCompleted = function(text
, xml
) {
111 xob
.onError = function() {
115 xob
.post('/pptpd.cgi', 'disconnect=' + pid
);
118 var ref
= new TomatoRefresh('/update.cgi', 'exec=pptpd_userol', 0, 'pptpd_userol_refresh');
120 ref
.refresh = function(text
) {
127 var dg
= new TomatoGrid();
129 dg
.sortCompare = function(a
, b
) {
130 var col
= this.sortColumn
;
131 var ra
= a
.getRowData();
132 var rb
= b
.getRowData();
137 r
= cmpIP(ra
.ip
, rb
.ip
);
140 r
= cmpText(a
.cells
[col
].innerHTML
, b
.cells
[col
].innerHTML
);
143 r
= cmpIP(ra
.ip
, rb
.ip
);
144 if (r
== 0) r
= cmpText(ra
.ifname
, rb
.ifname
);
146 return this.sortAscending
? r
: -r
;
149 dg
.populate = function() {
153 for (i
= 0; i
< list
.length
; ++i
) {
156 list
[i
].username
= '';
159 list
[i
].sourceip
= '';
162 for (i
= pptpd_online
.length
- 1; i
>= 0; --i
) {
172 for (i
= list
.length
- 1; i
>= 0; --i
) {
174 hangup
= '<div id="div_'+e
.pid
+'"><a href="javascript:disconnect(\'div_'+e
.pid
+ '\',' + e
.pid
+ ')" title="Disconnect" id="pid_' + e
.pid
+ '">Disconnect</a></div>';
176 // this.insert(-1, e, [
177 // e.ifname, e.username, e.uptime, e.ip, e.sourceip, hangup], false);
179 dg
.insertData(-1, [ e
.ifname
, e
.username
, e
.uptime
, e
.ip
, e
.sourceip
, hangup
]);
183 dg
.setup = function() {
184 this.init('dev-grid', 'sort');
185 this.headerSet(['Interface', 'Username', 'Online Since', 'VPN IP Address', 'Source IP Address', 'Action']);
190 function dateTimeString(timestamp
) {
191 var x
= new Date(timestamp
*1000);
192 var year
= x
.getFullYear();
193 var month
= (x
.getMonth() + 1).pad(2);
194 var day
= (x
.getDate()).pad(2);
195 var time
= timeString((x
.getHours() * 60) + x
.getMinutes());
196 return (year
+ '-' + month
+ '-' + day
+ ' ' + time
);
199 dg
.dataToView = function(data
) {
201 if (data
[2] < 946684800) {
205 // l = new Date(data[2] *1000);
206 // l = l.toDateString() + ' ' + l.toTimeString();
208 l
= dateTimeString(data
[2]);
218 function earlyInit() {
224 ref
.initPage(3000, 3);
228 <body onload='init()'
>
229 <table id='container' cellspacing=
0>
230 <tr><td colspan=
2 id='header'
>
231 <div class='title'
>Tomato
</div>
232 <div class='version'
>Version <%
version(); %></div>
234 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
236 <div id='ident'
><%
ident(); %></div>
237 <div class='section-title'
>PPTP Users Online
</div>
238 <div class='section'
>
239 <table id='dev-grid' class='tomato-grid' cellspacing=
0></table>
241 <div style=
"float:right;text-align:right">
242 » <a href=
"vpn-pptp-server.asp">Configure
</a>
245 <tr><td id='footer' colspan=
2><script type='text/javascript'
>genStdRefresh(1,1,'ref.toggle()');</script></td></tr>
247 <script type='text/javascript'
>earlyInit();</script>