-
Notifications
You must be signed in to change notification settings - Fork 5
/
ajax.logins.php
57 lines (48 loc) · 1.81 KB
/
ajax.logins.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
global $no_session_refresh; $no_session_refresh=TRUE;
include 'core/Page.php';
$url_map=array(
"/ranged.csv"=>"Data",
"/inspect.session"=>"Session",
"/inspect.session.id"=>"Session",
"/file"=>"FILES",
);
function get_url_map($s,$arr) {
foreach ( $arr as $k=>$v ) if ( stripos($s,$k) !== FALSE ) return $v;
$s=basename($s);
$s=explode(".",$s);
$s=$s[0];
return $s;
}
global $auth_database;
$m_sess=new Session($auth_database);
global $session;
if ( $m_sess->LoggedOut($session) ) { echo '0'; die; }
$sessions=$m_sess->ActiveUsers();
$m_auth=new Auth($auth_database);
$mod_model=new Modification($auth_database);
$result=array();
$was=array();
foreach ( $sessions as $s ) if ( !$m_sess->LoggedOut($s) ) {
$activity=' ';
$activity.=get_url_map($s['last_url'],$url_map);
if ( matches($activity,'request_login.php') ) continue;
$a=$m_auth->Get($s['r_Auth']);
if ( false_or_null($a) ) continue;
$found=FALSE;
foreach ( $was as $u ) if ( matches($u,$a['username']) ) { $found=TRUE; break; }
if ( $found === TRUE ) continue;
$was[]=$a['username'];
$mod=$mod_model->Select(array('r_Auth'=>$a['ID']),'*',"",'ORDER BY Timestamp DESC',1);
if ( !false_or_null($mod) ) {
$lastmod=(strtotime('now')-intval($mod[0]['Timestamp']))/60;
if ( intval($lastmod) > 0 ) $lastmod=intval($lastmod).'m';
else $lastmod='';
} else $lastmod='';
if ( strlen(trim($activity)) == 0 ) $activity=' <span class="fi-skull"></span> '.(strtotime('now')-$s['refreshed']).'s'.' '.$lastmod.'</small>';
else $activity='<small>'.'<span class="bottomtinytag">'.$activity.'</span> '.(strtotime('now')-$s['refreshed']).'s'.' '.$lastmod.'</small>';
$result[]=trim('<b>'.$a['username'].'</b> '.$activity);
}
$result=array_unique($result);
$result=implode(' | ',$result);
echo /*'Logged in: '.*/rtrim($result,',');