New features #124

Merged
OpzekerIT merged 12 commits from dev into main 2023-11-16 13:57:48 +00:00
5 changed files with 94 additions and 100 deletions

View file

@ -1,48 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<?php include './includes/head.php'; ?>
<body>
<?php include './includes/navigation.php'; ?>
<header>
<img src="./images/banner2.png" alt="banner" class="banner">
</header>
<main>
<section>
<h2>Clan Stats</h2>
<?php
include './config/config.php';
// Load clan data from claninfo.json
$clanInfoPath = './data/claninfo.json';
$clanmembersfile = './config/clanmembers.json';
$clanmembers = json_decode(file_get_contents($clanmembersfile), true);
if (file_exists($clanInfoPath)) {
$clan = json_decode(file_get_contents($clanInfoPath), true);
if (isset($clan) && !empty($clan)) {
echo "<table>";
echo "<tr><th>Attribute</th><th>Value</th></tr>";
foreach ($clan as $key => $value) {
echo "<tr><td>" . htmlspecialchars($key) . "</td><td>" . htmlspecialchars($value) . "</td></tr>";
}
foreach ($clanmembers['clanMembers'] as $value) {
echo "<tr><td><a href='latestmatches.php?selected_player=" . htmlspecialchars($value) . "'>name</a></td><td><a href='latestmatches.php?selected_player=" . htmlspecialchars($value) . "'>" . htmlspecialchars($value) . "</a></td></tr>";
}
echo "</table>";
} else {
echo "<p>No clan attributes available</p>";
}
} else {
echo "<p>Clan info file missing</p>";
}
?>
</section>
</main>
<?php include './includes/footer.php'; ?>
</body>
</html>

View file

@ -9,7 +9,6 @@ if ($host == 'dev.dtch.online') {
<a href="index.php" class="active">Home</a>
<div id="myLinks">
<a href="clan_stats.php">Clan Stats</a>
<a href="user_stats.php">User Stats</a>
<a href="topstats.php">Top10</a>
<a href="topstatsavg.php">Match % T10</a>

View file

@ -25,6 +25,7 @@ $lastMatches = array_slice($allMatches, 0, 8);
<!DOCTYPE html>
<html lang="en">
<?php include './includes/head.php'; ?>
<body>
<?php include './includes/navigation.php'; ?>
@ -37,7 +38,7 @@ $lastMatches = array_slice($allMatches, 0, 8);
<h2>Latest Matches</h2>
<table>
<thead>
<tr>
<!-- <th>Match Date</th> -->
<th>Player Name</th>
@ -48,8 +49,8 @@ $lastMatches = array_slice($allMatches, 0, 8);
<th>Damage</th>
<th>Place</th>
</tr>
</thead>
<tbody>
<?php
$mapNames = array(
"Baltic_Main" => "Erangel",
@ -79,9 +80,40 @@ $lastMatches = array_slice($allMatches, 0, 8);
</tr>";
} ?>
</tbody>
</table>
</table>
<h2>Clan Info</h2>
<?php
//CLANINFO
$clanInfoPath = './data/claninfo.json';
$clanmembersfile = './config/clanmembers.json';
$clanmembers = json_decode(file_get_contents($clanmembersfile), true);
if (file_exists($clanInfoPath)) {
$clan = json_decode(file_get_contents($clanInfoPath), true);
if (isset($clan) && !empty($clan)) {
echo "<table>";
echo "<tr><th>Attribute</th><th>Value</th></tr>";
foreach ($clanmembers['clanMembers'] as $value) {
echo "<tr><td><a href='latestmatches.php?selected_player=" . htmlspecialchars($value) . "'>name</a></td><td><a href='latestmatches.php?selected_player=" . htmlspecialchars($value) . "'>" . htmlspecialchars($value) . "</a></td></tr>";
}
foreach ($clan as $key => $value) {
if($key == 'updated'){
continue;
}
echo "<tr><td>" . htmlspecialchars($key) . "</td><td>" . htmlspecialchars($value) . "</td></tr>";
}
echo "</table>";
} else {
echo "<p>No clan attributes available</p>";
}
} else {
echo "<p>Clan info file missing</p>";
}
?>
</section>
@ -90,4 +122,5 @@ $lastMatches = array_slice($allMatches, 0, 8);
<?php include './includes/footer.php'; ?>
</body>
</html>

View file

@ -24,10 +24,19 @@
echo "<button type='submit' name='selected_player' value='$player_name' class='btn'>$player_name</button>";
}
}
echo "</form><br>";
$selected_player = $_GET['selected_player'] ?? $players_matches[0]['playername'];
echo "<form method='get' action=''>
<input type='submit' name='filter_by_match_type' value='all' class='btn'>
<input type='submit' name='filter_by_match_type' value='airoyale' class='btn'>
<input type='submit' name='filter_by_match_type' value='official' class='btn'>
<input type='submit' name='filter_by_match_type' value='custom' class='btn'>
<input type='submit' name='filter_by_match_type' value='event' class='btn'>
<input type='hidden' name='selected_player' value='$selected_player'>
</form><br>";
$mapNames = array(
"Baltic_Main" => "Erangel",
"Chimera_Main" => "Paramo",
@ -50,10 +59,11 @@
echo "<tr><th>Match Date</th><th>Game Mode</th><th>Match Type</th><th>Map</th><th>Kills</th><th>Damage Dealt</th><th>Time Survived</th><th>win Place</th></tr>";
foreach ($player_data['player_matches'] as $match) {
if (isset($_GET['filter_by_match_type'])) {
if ($match['matchType'] !== $_GET['filter_by_match_type']) {
if ($_GET['filter_by_match_type'] !== 'all' && $match['matchType'] !== $_GET['filter_by_match_type']) {
continue;
}
}
$date = new DateTime($match['createdAt']);
$date->modify('+2 hours');

View file

@ -20,10 +20,10 @@ error_reporting(E_ALL);
include './config/config.php';
$players_data = json_decode(file_get_contents('./data/player_lifetime_data.json'), true);
$selected_mode = isset($_POST['game_mode']) ? $_POST['game_mode'] : 'squad';
$selected_mode = isset($_GET['game_mode']) ? $_GET['game_mode'] : 'squad';
// Form to select game mode
echo "<form method='post' action=''>
echo "<form method='get' action=''>
<input type='submit' name='game_mode' value='solo' class='btn'>
<input type='submit' name='game_mode' value='duo' class='btn'>
<input type='submit' name='game_mode' value='squad' class='btn'>