-
Notifications
You must be signed in to change notification settings - Fork 71
/
guild.php
150 lines (122 loc) · 5.69 KB
/
guild.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
<?php
require_once("config.php");
if (isset($_GET['id']) && is_numeric($_GET['id']))
{
$guildId = intval(mysqli_real_escape_string($db, $_GET['id']));
}
else
{
die("Invalid guild ID");
}
require_once("variables.php");
require_once("functions.php");
$guildName = getGuildName($guildId);
if (!$guildName) {
die("Guild not found");
}
function getGuildPlayers()
{
global $db, $players_group_and_order, $guildId;
$query = sprintf("SELECT
character_guid,
count(character_guid) AS `count`,
COALESCE(NULLIF(characters.name,''), characters.deleteInfos_Name) AS `character_name`,
characters.class AS `character_class`,
characters.race AS `character_race`,
characters.gender AS `character_gender`,
characters.level AS `character_level`,
characters.totalKills AS `character_totalKills`
FROM pvpstats_players
INNER JOIN pvpstats_battlegrounds ON pvpstats_players.battleground_id = pvpstats_battlegrounds.id AND pvpstats_players.winner = 1
INNER JOIN characters ON pvpstats_players.character_guid = characters.guid AND characters.deleteDate IS NULL
INNER JOIN guild_member ON guild_member.guid = characters.guid AND guild_member.guildid = %d
%s LIMIT 0,100",
$guildId,
$players_group_and_order);
$result = $db->query($query);
if (!$result) {
die(mysqli_error($db));
}
$position = 0;
$prev_score = 0;
while (($row = $result->fetch_array()) != null)
{
if ($prev_score != $row['count']) {
$position++;
}
$player_name = sprintf("<span style=\"color: %s; \"><strong>%s</strong></a>",
getPlayerColorByRace($row['character_race']),
$row['character_name']);
printf("
<tr>
<td>%d</td>
<td>%s</td>
<td style=\"min-width: 46px; padding-left: 0; padding-right: 0;\"><img src=\"img/class/%d.gif\"> <img src=\"img/race/%d-%d.gif\"></td>
<td>%s</td>
<td>%d</td>
<td><strong>%d</strong></td>
</tr>",
$position,
$player_name,
$row['character_class'],
$row['character_race'],
$row['character_gender'],
$row['character_level'],
$row['character_totalKills'],
$row['count']
);
$prev_score = $row['count'];
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="PvPstats, see who is winning!">
<meta name="author" content="ShinDarth">
<title><?= $server_name ?> PvPstats</title>
<link href="css/bootstrap-cyborg.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href="css/top100-style.css" rel="stylesheet">
</head>
<body>
<?php require_once("navbar.php"); ?>
<div class="container">
<div class="row text-center">
<div class="col-sm-12 col-lg-10 col-lg-offset-1" style="padding: 0 10px;">
<div class="main-title" style="margin-top: 30px;">
<p class="text-center h4">Guild <span style="color: orange;"><<?=$guildName?>></span> of <?=$server_name?></p>
</div>
<p class="text-center" style="margin-top: 5px">The sum of the victories of all guild members determines the guild score in the <a href="top100.php">Top100</a>.</p>
<div class="top100 table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th class="text-center">#</th>
<th class="text-center">Character</th>
<th class="text-center">●</th>
<th class="text-center">Level</th>
<th class="text-center">Kills</th>
<th class="text-center">Victories</th>
</tr>
</thead>
<tbody>
<?php getGuildPlayers(); ?>
</tbody>
</table>
</div>
</div>
</div>
<div id="footer">
<hr>
<?php /* I worked hard to make PvPstats open and free for everyone. Please, do not remove the credits. */ ?>
<p class="h6 text-center">● <a target="_blank" href="https://github.com/FrancescoBorzi/PvPstats"><strong>PvPstats</strong></a> for <a target="_blank" href="<?= $server_url ?>"><?= $server_name ?></a> is free software created by <a target="_blank" href="http://shinworld.altervista.org/"><strong>ShinDarth</strong></a> and released under the <a target="_blank" href="https://github.com/FrancescoBorzi/PvPstats/blob/master/LICENSE">GNU AGPL license</a> ●</p>
<p class="text-center" style="margin-top: 20px"><iframe src="http://ghbtns.com/github-btn.html?user=FrancescoBorzi&repo=PvPstats&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110" height="20"></iframe> <iframe src="http://ghbtns.com/github-btn.html?user=FrancescoBorzi&repo=PvPstats&type=fork&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="95" height="20"></iframe> <iframe src="http://ghbtns.com/github-btn.html?user=FrancescoBorzi&type=follow&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="165" height="20"></iframe></p>
</div>
</div><!-- /.container -->
</body>
</html>
<?php $db->close(); ?>