-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathonline2.php
More file actions
148 lines (122 loc) · 4.19 KB
/
online2.php
File metadata and controls
148 lines (122 loc) · 4.19 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
require_once('./oj-header.php');
require_once('./include/db_info.inc.php');
require_once('./include/iplocation.php');
if($OJ_ONLINE){
$users = $on->getAll();
$ip = new IpLocation();
}
?>
<?php if($OJ_ONLINE) {
?>
<h3>current online user: <?=$on->get_num()?></h3>
<table style="margin:auto;width:98%">
<thead>
<tr><th style="width: 50px">ip</th><th>uri</th><th>refer</th><th style="width:100px">stay time</th><th>user agent</th></tr>
</thead>
<tbody>
<?php foreach($users as $u):
if(is_object($u)){
?>
<tr><td class="ip">
<?php $l = $ip->getlocation($u->ip);
echo $u->ip.'<br />';
if(strlen(trim($l['area']))==0)
echo $l['country'];
else
echo $l['area'].'@'.$l['country'];
?></td><td><?=$u->uri?></td><td><?=$u->refer?></td>
<td class="time"><?=sprintf("%dmin %dsec",($u->lastmove-$u->firsttime)/60,($u->lastmove-$u->firsttime) % 60)?></td><td><?=$u->ua?></td></tr>
<?php
}
endforeach;?>
</tbody>
</table>
<?php }
?>
<?
if (isset($_SESSION['administrator'])){
echo "<center>";
echo "<td width='100%' colspan='5'><form>IP(支持模糊查找)<input type='text' name='search'><input type='submit' value='$MSG_SEARCH' ></form></td></tr>";
echo "<center>";
echo "<td width='100%' colspan='5'><form>UserName(支持模糊查找)<input type='text' name='diffip'><input type='submit' value='DiffIp' ></form></td></tr>";
echo "<center>";
echo "<td width='100%' colspan='5'><font color='eeeeee'><form><input type='text' name='delete' style='border:0;background:transparent;'><input type='submit' style='color:eeeeee;border:0;background:transparent;' value='Delete' ></form></font></td></tr>";
if(isset($_GET['delete'])){
$today=date('Y-m-d');
$sql="delete from loginlog where time>='$today'";
$result=mysql_query($sql);
}
if(isset($_GET['search'])){
$sql="SELECT * FROM `loginlog`";
$search=trim(mysql_real_escape_string($_GET['search']));
if ($search!='')
$sql=$sql." WHERE ip like '%$search%' ";
// else
// $sql=$sql." where user_id<> 'xiao'";
$sql=$sql." order by `time` desc LIMIT 0,100";
$result=mysql_query($sql) or die(mysql_error());
echo "<table border=1>";
echo "<tr align=center><td>UserID<td>Password<td>IP<IP>Location<td>Time</tr>";
for (;$row=mysql_fetch_row($result);){
echo "<tr align=center>";
echo "<td><a href='userinfo.php?user=".$row[0]."'>".$row[0]."</a>";
echo "<td>".$row[1];
echo "<td>".$row[2];
$l = $ip->getlocation($row[2]);
if(strlen(trim($l['area']))==0)
echo "<td>".$l['country'];
else
echo "<td>".$l['area'].'@'.$l['country'];
echo "<td>".$row[3];
echo "</tr>";
}
echo "</table>";
echo "</center>";
mysql_free_result($result);
}
}
?>
<?
if (isset($_SESSION['administrator'])){
//echo "<center>";
//echo "<td width='100%' colspan='5'><form>UserName(支持模糊查找)<input type='text' name='diffip'><input type='submit' value='DiffIp' ></form></td></tr>";
if(isset($_GET['diffip'])){
$sql="SELECT DISTINCT(user_id) FROM `loginlog`";
$search1=trim(mysql_real_escape_string($_GET['diffip']));
if ($search1!='')
$sql=$sql." WHERE user_id like '%$search1%' ";
$sql=$sql." order by `time` desc LIMIT 0,170";
$result=mysql_query($sql) or die(mysql_error());
echo "<table border=1>";
echo "<tr align=center><td>UserID<td>Password<td>IP<td>Time</tr>";
for (;$row=mysql_fetch_row($result);){
$sql1="SELECT * FROM `loginlog` where user_id=\"".$row[0]."\" order by `time` desc LIMIT 0,2";
$result1=mysql_query($sql1) or die(mysql_error());
$rowa=mysql_fetch_row($result1);
$a=$rowa[2];
$temp=$rowa[3];
$data1=strtotime($rowa[3]);
$rowa=mysql_fetch_row($result1);
$b=$rowa[2];
$data2=strtotime($rowa[3]);
//echo date('Y-m-d',$data1);
// $rowa=mysql_fetch_row($result1);
// $c=$rowa[2];
if($a<>$b && date('Y-m-d',$data1)==date('Y-m-d',$data2) )
{
echo "<tr align=center>";
echo "<td><a href='userinfo.php?user=".$rowa[0]."'>".$rowa[0]."</a>";
echo "<td>".$rowa[1];
echo "<td>".$rowa[2];
echo "<td>".$rowa[3];
echo "</tr>";
}
}
echo "</table>";
echo "</center>";
mysql_free_result($result);
}
}
?>
<?php require_once('oj-footer.php')?>