File tree Expand file tree Collapse file tree 3 files changed +55
-0
lines changed Expand file tree Collapse file tree 3 files changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -362,6 +362,20 @@ <h3>
362
362
</ div > <!-- /widget-content -->
363
363
</ div > <!-- /widget -->
364
364
</ div > <!-- /span6 -->
365
+ < div class ="span6 ">
366
+ < div id ="lastlog-widget " class ="widget widget-table action-table ">
367
+ < div class ="widget-header ">
368
+ < i class ="icon-group "> </ i >
369
+ < h3 >
370
+ Last Login
371
+ </ h3 >
372
+ < div id ="refresh-lastlog " class ="btn icon-refresh js-refresh-info "> </ div >
373
+ </ div > <!-- /widget-header -->
374
+ < div class ="widget-content ">
375
+ < table id ="lastlog_dashboard " class ="table table-hover table-bordered table-condensed "> </ table >
376
+ </ div > <!-- /widget-content -->
377
+ </ div > <!-- /widget -->
378
+ </ div > <!-- /span6 -->
365
379
</ div > <!--./row -->
366
380
367
381
< div class ="row ">
Original file line number Diff line number Diff line change @@ -213,6 +213,31 @@ dashboard.getOnline = function () {
213
213
$ ( "select[name='online_dashboard_length']" ) . val ( "5" ) ;
214
214
}
215
215
216
+ dashboard . getLastLog = function ( ) {
217
+ $ . get ( "sh/lastlog.php" , function ( data ) {
218
+ destroy_dataTable ( "lastlog_dashboard" ) ;
219
+
220
+ $ ( "#lastlog_dashboard" ) . dataTable ( {
221
+ aaData : data ,
222
+ aoColumns : [
223
+ { sTitle : "Who" } ,
224
+ { sTitle : "From" } ,
225
+ { sTitle : "Last Login" } ,
226
+ ] ,
227
+ aaSorting : [
228
+ [ 2 , "desc" ]
229
+ ] ,
230
+ iDisplayLength : 5 ,
231
+ bPaginate : true ,
232
+ sPaginationType : "full_numbers" ,
233
+ bFilter : false ,
234
+ bAutoWidth : false ,
235
+ bInfo : false
236
+ } ) . fadeIn ( ) ;
237
+ } , "json" ) ;
238
+ $ ( "select[name='lastlog_dashboard_length']" ) . val ( "5" ) ;
239
+ }
240
+
216
241
dashboard . getRam = function ( ) {
217
242
$ . get ( "sh/mem.php" , function ( data ) {
218
243
var ram_total = data [ 1 ] ;
@@ -453,6 +478,7 @@ dashboard.fnMap = {
453
478
os : dashboard . getOs ,
454
479
users : dashboard . getUsers ,
455
480
online : dashboard . getOnline ,
481
+ lastlog : dashboard . getLastLog ,
456
482
whereis : dashboard . getWhereIs ,
457
483
ip : dashboard . getIp ,
458
484
ispeed : dashboard . getIspeed ,
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ exec (
4
+ '/usr/bin/lastlog --time 365 | ' .
5
+ ' /usr/bin/awk \'{print $1","$3","$4" "$5" "$6" "$7" "$8} \'' ,
6
+ $ users
7
+ );
8
+ $ result = array ();
9
+ # ignore the first line of column names
10
+ for ($ i = 1 ; $ i < count ($ users ); ++$ i ) {
11
+ $ result [$ i -1 ] = explode (", " , $ users [$ i ]);
12
+ }
13
+
14
+ header ('Content-Type: application/json; charset=UTF-8 ' );
15
+ echo json_encode ($ result );
You can’t perform that action at this time.
0 commit comments