-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.php
270 lines (241 loc) · 12.2 KB
/
index.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
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
<?php
require __DIR__ . '/SourceQuery/SourceQuery.class.php';
include("config.php");
?>
<!DOCTYPE html>
<head>
<title><?php echo $Title; ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/global.css">
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<?php
$action = filter_input(INPUT_GET, 'toggle');
if($action == "stopRefresh") {
echo "";
} else {
?>
<script type="text/javascript">
function startRefresh() {
$.get('#', function(data) {
$(document.body).html(data);
});
}
$(function() {
setTimeout(startRefresh,30000);
});
</script>
<?php
}
?>
</head>
<body>
<div class="container">
<div class="jumbotron center">
<?php
if($data_ad_enable == true) {
?>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block"
data-ad-client="<?php echo $data_ad_client; ?>"
data-ad-slot="<?php echo $data_ad_slot; ?>"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<?php
} else {
echo " ";
}
?>
<h1><?php echo $Title; ?></h1>
<p>Check the status of <?php echo $Title; ?>.</p>
<a class="btn btn-info btn-lg center" href="?toggle=stopRefresh" role="button">Stop AutoRefresh</a>
<button class="btn btn-primary btn-lg center" onclick="$('.collapse').collapse('toggle')">Toggle Collapse</button>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><div class="panel panel-default"><div class="panel-heading"><h1 class="center panel-title"><?php echo $News; ?></h1></div></div></div>
<?php
for ($Config = 0; $Config < count($Status); $Config++) {
$TotalServers = count($Status);
$TotalPlayers = $TotalServers * 24;
$Name = $Status[$Config]["Name"];
$HostName = $Status[$Config]["HostName"];
$ID = $Status[$Config]["ID"];
$Mode = $Status[$Config]["Mode"];
$Port = $Status[$Config]["Port"];
$Vote1 = $Status[$Config]["Vote1"];
$Vote2 = $Status[$Config]["Vote2"];
$SourceQuery = $Port + 1;
$Query = new SourceQuery();
$Info = Array();
$Players = Array();
$Rocket = Array();
try {
$Query->Connect($HostName, $SourceQuery, 1, 'SourceQuery :: SOURCE');
$Info = $Query->GetInfo();
$Players = $Query->GetPlayers();
$Rocket = $Query->GetRules();
}
catch (Exception $e) {
echo $e->getMessage();
}
$Query->Disconnect();
if ($Info["GameID"] >= "304930") {
$GameTags = explode(',', $Info["GameTags"]);
$Combat = $GameTags["0"];
$Difficulty = $GameTags["1"];
$Prespective = $GameTags["2"];
$SteamWorks = $GameTags["3"];
$Version = $Rocket["rocket"];
$Plugins = str_replace(",", "<tr><td><li class=\"list-group-item\"><i class=\"fa fa-plug\"></i> ", $Rocket["rocketplugins"]);
if ($Combat == "PVE") {
$OnlinePVE += count($Combat);
} elseif ($Combat == "PVP") {
$OnlinePVP += count($Combat);
}
if($Mode == "PVE") {
$ModePvE += count($Mode);
} elseif ($Mode == "PVP") {
$ModePvP += count($Mode);
} elseif ($Mode == "ARENA") {
$ModeArena += count($Mode);
}
$TotalPlugins = substr_count($Rocket["rocketplugins"], ',') + 1;
$OnlinePlayers += $Info["Players"];
$OnlineMaxPlayers += $Info["MaxPlayers"];
?>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">
<div class="panel panel-default">
<div class="panel-heading">
<h1 class="panel-title center"><?php echo $Name; ?></h1> <div align="center" class="large"><?php echo $HostName; ?> <button class="btn-copy btn btn-xs btn-primary" data-clipboard-text="<?php echo $HostName; ?>"><i class="fa fa-clipboard"></i></button></div>
<div class="btn-group btn-group-xs btn-group-justified click-actions" role="group">
<span class="btn btn-xs btn-success" style="width:70%;">Online | Players: <?php echo "".$Info["Players"]."/".$Info["MaxPlayers"]."";?></span>
<a class="btn btn-default" style="width:30%;" role="button" data-toggle="collapse" href="#Unturned<?php echo $ID;?>Vote" aria-expanded="false" aria-controls="Unturned<?php echo $ID;?>Vote"><i class="fa fa-thumbs-up"></i> Vote</a>
</div>
<div class="btn-group btn-group-xs btn-group-justified click-actions" role="group">
<a class="btn btn-info" role="button" data-toggle="collapse" href="#Unturned<?php echo $ID;?>" aria-expanded="false" aria-controls="Unturned<?php echo $ID;?>">Click for More Info</a>
<a href="steam://connect/<?php echo $HostName; ?>:<?php echo $SourceQuery; ?>" class="btn btn-warning">Click to Connect</a>
</div>
</div>
<ul class="list-group">
<div class="collapse" id="Unturned<?php echo $ID;?>Vote">
<a href="<?php echo $Vote1; ?>" target="_blank" class="list-group-item list-group-item-warning"><i class="fa fa-comments"></i> Vote on unturned-servers.net</a>
<a href="<?php echo $Vote2; ?>" target="_blank" class="list-group-item list-group-item-warning"><i class="fa fa-comments"></i> Vote on unturnedls.com</a>
</div>
<div class="collapse" id="Unturned<?php echo $ID;?>">
<li class="list-group-item"><i class="fa fa-group"></i> Players: <b><?php echo "".$Info["Players"]."/".$Info["MaxPlayers"]."";?></b> <span class="label label-info" role="button" data-toggle="collapse" href="#Unturned<?php echo $ID;?>Players" aria-expanded="false" aria-controls="Unturned<?php echo $ID;?>Players">Full List</span></li>
<div class="collapse" id="Unturned<?php echo $ID;?>Players">
<table class="table table-condensed table-responsive no-margin">
<tbody>
<?php if( !empty( $Players ) ): ?>
<?php foreach( $Players as $Player ): ?>
<tr>
<td><li class="list-group-item"><i class="fa fa-user"></i> <?php echo htmlspecialchars( $Player[ 'Name' ] ); ?></li></td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="3">No players received</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
<li class="list-group-item"><i class="fa fa-gear"></i> Unturned: <b><?php echo $Rocket["unturned"]; ?></b></li>
<li class="list-group-item"><i class="fa fa-rocket"></i> Rocket: <b><?php echo $Version; ?></b></li>
<li class="list-group-item"><i class="fa fa-product-hunt"></i> Rocket Plugins: <b><?php echo $TotalPlugins; ?></b> <span class="label label-info" role="button" data-toggle="collapse" href="#Unturned<?php echo $ID;?>Plugins" aria-expanded="false" aria-controls="Unturned<?php echo $ID;?>Plugins">Full List</span></li>
<div class="collapse" id="Unturned<?php echo $ID;?>Plugins">
<table class="table table-condensed table-responsive no-margin">
<tbody>
<tr>
<td>
<?php
echo "
<li class=\"list-group-item\"><i class=\"fa fa-plug\"></i> $Plugins</li></td>
</tr>";
?>
</tbody>
</table>
</div>
<li class="list-group-item"><i class="fa fa-compass"></i> Map: <b><?php echo $Info["Map"]; ?></b></li>
<li class="list-group-item"><i class="fa fa-eye"></i> Perspective: <b><?php echo $Prespective; ?></b></li>
<li class="list-group-item"><i class="fa fa-wrench"></i> Difficulty: <b><?php echo $Difficulty; ?></b></li>
<li class="list-group-item"><i class="fa fa-server"></i> IP: <b><?php echo $HostName; ?></b></li>
<li class="list-group-item"><i class="fa fa-play"></i> Port: <b><?php echo $Port; ?></b></li>
</div>
</ul>
</div>
</div>
<?php
} else {
?>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">
<div class="panel panel-default">
<div class="panel-heading">
<h1 class="panel-title center"><?php echo $Name; ?> <p class="small"><?php echo $HostName; ?></p></h1>
<div class="btn-group btn-group-xs btn-group-justified click-actions" role="group">
<span class="btn btn-xs btn-danger" style="width:70%;">Offline</span>
<a class="btn btn-default" style="width:30%;" role="button" data-toggle="collapse" href="#Unturned<?php echo $ID;?>Vote" aria-expanded="false" aria-controls="Unturned<?php echo $ID;?>Vote"><i class="fa fa-thumbs-up"></i> Vote</a>
</div>
<div class="btn-group btn-group-xs btn-group-justified click-actions" role="group">
<a class="btn btn-info disabled" role="button" data-toggle="collapse" href="#Unturned<?php echo $ID;?>" aria-expanded="false" aria-controls="Unturned<?php echo $ID;?>">Click for More Info</a>
<a href="#" class="btn btn-warning disabled">Click to Connect</a>
</div>
</div>
<ul class="list-group">
<div class="collapse" id="Unturned<?php echo $ID;?>Vote">
<a href="<?php echo $Vote1; ?>" target="_blank" class="list-group-item list-group-item-warning"><i class="fa fa-comments"></i> Vote on unturned-servers.net</a>
<a href="<?php echo $Vote2; ?>" target="_blank" class="list-group-item list-group-item-warning"><i class="fa fa-comments"></i> Vote on unturnedls.com</a>
</div>
</ul>
</div>
</div>
<?php
}
}
?>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
<h1 class="panel-title stats center">Overall Stats</h1>
<div class="center"><div class="btn-group" role="group">
<span class="btn btn-primary"><i class="fa fa-group"></i> Total Players: <?php echo $TotalPlayers; ?></span>
<span class="btn btn-primary"><i class="fa fa-globe"></i> Total Servers: <?php echo $TotalServers; ?></span>
<span class="btn btn-info"><i class="fa fa-group"></i> Current Players: <?php echo $OnlinePlayers; ?></span>
<span class="btn btn-info"><i class="fa fa-group"></i> Current Max Players: <?php echo $OnlineMaxPlayers; ?></span>
</div>
<br />
<br />
<div class="center"><div class="btn-group" role="group">
<span class="btn btn-success"><i class="fa fa-globe"></i> PvE Online: <?php echo $OnlinePVE; ?></span>
<span class="btn btn-success"><i class="fa fa-globe"></i> PvP Online: <?php echo $OnlinePVP; ?></span>
<span class="btn btn-success"><i class="fa fa-globe"></i> Arena Online: <?php echo $ModeArena; ?></span>
<span class="btn btn-warning"><i class="fa fa-globe"></i> Total PvE Servers: <?php echo $ModePvE; ?></span>
<span class="btn btn-warning"><i class="fa fa-globe"></i> Total PvP Servers: <?php echo $ModePvP; ?></span>
<span class="btn btn-warning"><i class="fa fa-globe"></i> Total Arena Servers: <?php echo $ModeArena; ?></span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="js/clipboard.min.js"></script>
<script>
var clipboard = new Clipboard('.btn-copy');
clipboard.on('success', function(e) {
console.info('Action:', e.action);
console.info('Text:', e.text);
console.info('Trigger:', e.trigger);
e.clearSelection();
});
clipboard.on('error', function(e) {
console.log(e);
});
</script>
</body>
</html>