-
Notifications
You must be signed in to change notification settings - Fork 9
/
gangwars.php
52 lines (51 loc) · 1.54 KB
/
gangwars.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
<?php
declare(strict_types=1);
/**
* MCCodes v2 by Dabomstew & ColdBlooded
*
* Repository: https://github.com/davemacaulay/mccodesv2
* License: MIT License
*/
global $db, $h;
require_once('globals.php');
echo "<h3>Gang Wars</h3>
<table width='75%' cellspacing='1' class='table'>";
$q =
$db->query(
"SELECT `w`.*, `g1`.`gangNAME` AS `declarer`,
`g1`.`gangRESPECT` AS `drespect`,
`g2`.`gangNAME` AS `defender`,
`g2`.`gangRESPECT` AS `frespect`
FROM `gangwars` AS `w`
INNER JOIN `gangs` AS `g1`
ON `w`.`warDECLARER` = `g1`.`gangID`
INNER JOIN `gangs` AS `g2`
ON `w`.`warDECLARED` = `g2`.`gangID`
WHERE `g1`.`gangNAME` != ''
AND `g2`.`gangNAME` != ''");
if ($db->num_rows($q) > 0)
{
while ($r = $db->fetch_row($q))
{
echo "<tr>
<td width='45%'>
<a href='gangs.php?action=view&ID={$r['warDECLARER']}'>
{$r['declarer']}
</a> [{$r['drespect']} respect]
</td>
<td width='10%'>vs.</td>
<td width='45%'>
<a href='gangs.php?action=view&ID={$r['warDECLARED']}'>
{$r['defender']}
</a> [{$r['frespect']} respect]
</td>
</tr>";
}
echo '</table>';
}
else
{
echo '</table>There are currently no gang wars in progress.';
}
$db->free_result($q);
$h->endpage();