-
Notifications
You must be signed in to change notification settings - Fork 6
/
players.php
95 lines (81 loc) · 2.86 KB
/
players.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
<?php
// Be sure that the paths are correct
include("config.php");
include("lib/functions.php");
require_once 'lib/steam-condenser/lib/steam-condenser.php';
mysql_connect($host, $user, $pass) or die(mysql_error());
mysql_select_db($table) or die(mysql_error());
$settings = getsettings();
//error_reporting(E_ALL);
error_reporting(E_ERROR);
ini_set("display_errors", 1);
$serverid = $_GET['serverid'];
$result = mysql_query( "SELECT * from servers where serverid=$serverid") or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
$portNumber = $row['port'];
$ip = $row['ip'];
$rconpass = $row['rconpass'];
$servername = $row['servername'];
}
?>
<style type="text/css">
tr.d0 td {
background-color: #D3D3D3; color: black;
}
tr.d1 td {
background-color: #C0C0C0; color: black;
}
</style>
<?
$ipAddress = $ip;
$server = new SourceServer($ipAddress, $portNumber);
echo '<link rel="stylesheet" href="css/main.css">';
try {
$players = $server->getPlayers($rconpass);
} catch (Exception $e) {
echo 'Server unreachable.'; exit;
}
if (empty($players)) { echo 'No active players found on server'; exit;}
if ($settings['usestats']['config'] == 'yes') {
$statsinfo[0] = $settings['statsprogram']['config'];
$statsinfo[1] = $settings['statsurl']['config'];
}
echo "<table>";
echo "<tr bgcolor=FF8C00><th width=14%>Name</th><th width=25%>Score</th><th width=14%>Ping</th><th width=14%>steamid</th><th width=14%>connect time</th><th width=14%>state</th><th width=14%>ip</th><th width=14% nowrap=nowrap>Quick Info</th></tr>";
$i=0;
foreach($players as $player) {
$steamid = $player->getsteamid();
$statsinfo[2] = $steamid;
$name = $player->getName();
if ($i%2 == 0) { echo "<tr class=d0>"; $i++; }
else { echo "<tr class=d1>"; $i++; }
if ($name == "") { echo "<td>New player connecting</td>"; }
else { echo "<td>{$player->getName()}</td>"; }
echo "<td>{$player->getScore()}</td>";
echo "<td>{$player->getPing()}</td>";
try {
$profile = SteamId::convertSteamIdToCommunityId($steamid);
}
catch(Exception $e) {
$profile = 'ERROR';
}
// $steamid = $player->getsteamid();
echo "<td><a href=\"http://steamcommunity.com/profiles/$profile\" title=\"$name\" target=_blank>$steamid</a></td>";
$seconds=$player->getconnectTime();
$time=sec2hms($seconds);
echo "<td>$time</td>";
echo "<td>{$player->getstate()}</td>";
echo "<td>{$player->getipaddress()}</td>";
$statsinfo[3] = "none";
$steamrep[0] = "steamrep";
$steamrep[1] = "http://www.steamrep.com/profiles";
$steamrep[2] = "$profile";
$steamrep[3] = "none";
$t1 = getstatsurl($statsinfo);
$t2 = getstatsurl($steamrep);
$tt = "$t1 $t2";
echo "<td>$tt</td>";
echo "</tr>";
}
echo "</table>";
?>