-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathonline.php
92 lines (90 loc) · 5.06 KB
/
online.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
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
<?
$title="Online Players";
include("members/config.php");
include("members/header.php");
checks();
online();
$res=$mysqli->query("SELECT Level FROM Players WHERE id='$_COOKIE[id]' LIMIT 1;");
$row=$res->fetch_array();
$lvl=$row[0];
function userBadges($donor, $level) {
if ($donor == 1) {echo " <span class=\"label label-info\">VIP</span>";}
if ($level > 0) {echo " <span class=\"label label-inverse\">Staff</span>";}
}
?>
<div class="page-header"><h1>Online Players <small>See who's online</small></h1></div>
<ul class="nav nav-pills">
<li class="active"><a href="#main" data-toggle="tab">All</a></li>
<li><a href="#friends" data-toggle="tab">Friends</a></li>
<li><a href="#heist" data-toggle="tab">Available for Heist</a></li>
<li><a href="#staff" data-toggle="tab">Staff</a></li>
</ul>
<div class="tab-content">
<div id="main" class="tab-pane active">
<div class="row-fluid">
<?
$offline=(time()-300);
$users=$mysqli->query("SELECT username, id, lastip, avatar, donor, Level FROM Players WHERE online >= '$offline' ORDER BY username ASC");
// All users page
$i=0;
while ($user=$users->fetch_assoc())
{
$id = $user['id'];
$i++;
if($i > 4) { echo "</div><div class=\"row-fluid\">"; $i=1; }
echo "<div class=\"well well-small span3\"><div class=\"row-fluid\"><div class=\"span3\"><img class=\"img-rounded\" height=\"60px\" width=\"60px\" src=\"$user[avatar]\"></div><div class=\"span9\" style=\"position: relative; height: 60px;\"><span style=\"position: absolute; bottom: 0;\"><a href=\"profile.php?id=$user[id]\">"; if($lvl == 2) { echo "<strong>$user[username]</a></strong><br>$user[lastip]<br>"; } else { echo "<h4>$user[username]</a></h4>"; } userBadges($user['donor'], $user['Level']); echo "</span></div></div></div>";
}
?> </div></div><div id="friends" class="tab-pane"><div class="row-fluid"> <?
$users=$mysqli->query("SELECT username, id, lastip, avatar, donor, Level FROM Players WHERE online >= '$offline' ORDER BY username ASC");
// Friends page
$i=0;
while ($user=$users->fetch_assoc())
{
$id = $user['id'];
$sql=$mysqli->query("SELECT * FROM friendslist WHERE username='$u' AND friend='$user[username]' LIMIT 1");
if($sql->num_rows > 0) {
$i++;
if($i > 4) { echo "</div><div class=\"row-fluid\">"; $i=1; }
echo "<div class=\"well well-small span3\"><div class=\"row-fluid\"><div class=\"span3\"><img class=\"img-rounded\" height=\"60px\" width=\"60px\" src=\"$user[avatar]\"></div><div class=\"span9\" style=\"position: relative; height: 60px;\"><span style=\"position: absolute; bottom: 0;\"><a href=\"profile.php?id=$user[id]\">"; if($lvl == 2) { echo "<strong>$user[username]</a></strong><br>$user[lastip]<br>"; } else { echo "<h4>$user[username]</a></h4>"; } userBadges($user['donor'], $user['Level']); echo "</span></div></div></div>";
}
}
?> </div></div><div id="heist" class="tab-pane"><div class="row-fluid"> <?
$users=$mysqli->query("SELECT username, id, lastip, ortime, avatar, donor, Level FROM Players WHERE online >= '$offline' ORDER BY username ASC");
// Available for Heist page
$i=0;
while ($user=$users->fetch_assoc())
{
$id = $user['id'];
$ORsd=$user['ortime']-time();
if($ORsd > 0) {
$i++;
if($i > 4) { echo "</div><div class=\"row-fluid\">"; $i=1; }
echo "<div class=\"well well-small span3\"><div class=\"row-fluid\"><div class=\"span3\"><img class=\"img-rounded\" height=\"60px\" width=\"60px\" src=\"$user[avatar]\"></div><div class=\"span9\" style=\"position: relative; height: 60px;\"><span style=\"position: absolute; bottom: 0;\"><a href=\"profile.php?id=$user[id]\">"; if($lvl == 2) { echo "<strong>$user[username]</a></strong><br>$user[lastip]<br>"; } else { echo "<h4>$user[username]</a></h4>"; } userBadges($user['donor'], $user['Level']); echo "</span></div></div></div>";
}
}
?> </div></div><div id="staff" class="tab-pane"> <?
$users=$mysqli->query("SELECT username, id, lastip, Level, avatar, donor, Level FROM Players WHERE online >= '$offline' ORDER BY username ASC");
// Staff page
$i=0;
while ($user=$users->fetch_assoc())
{
$id = $user['id'];
$i++;
if($i > 4) { echo "</div><div class=\"row-fluid\">"; $i=1; }
echo "<div class=\"well well-small span3\"><div class=\"row-fluid\"><div class=\"span3\"><img class=\"img-rounded\" height=\"60px\" width=\"60px\" src=\"$user[avatar]\"></div><div class=\"span9\" style=\"position: relative; height: 60px;\"><span style=\"position: absolute; bottom: 0;\"><a href=\"profile.php?id=$user[id]\">"; if($lvl == 2) { echo "<strong>$user[username]</a></strong><br>$user[lastip]<br>"; } else { echo "<h4>$user[username]</a></h4>"; } userBadges($user['donor'], $user['Level']); echo "</span></div></div></div>";
}
echo "</div></div>";
// Update the online record
$tonline=$users->num_rows;
$res=$mysqli->query("SELECT record, date FROM orecord WHERE id = '1' LIMIT 1");
$row=$res->fetch_array();
$monline = $row[0];
$mdate = $row[1];
if ($tonline > $monline) {
$mysqli->query("UPDATE orecord SET record = '$tonline', date = '$date' LIMIT 1");
}
echo "
Total users online: $tonline<br />
Most ever online: $monline Players at $mdate</div>";
include("members/footer.php");
?>