Clan info updated with clanmembers and clickable to latest matches #123
3 changed files with 25 additions and 24 deletions
|
|
@ -1,26 +1,23 @@
|
||||||
<?php
|
|
||||||
ini_set('display_errors', 1);
|
|
||||||
ini_set('display_startup_errors', 1);
|
|
||||||
error_reporting(E_ALL);
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<?php include './includes/head.php'; ?>
|
<?php include './includes/head.php'; ?>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<?php include './includes/navigation.php'; ?>
|
<?php include './includes/navigation.php'; ?>
|
||||||
<header>
|
<header>
|
||||||
<img src="./images/banner2.png" alt="banner" class="banner">
|
<img src="./images/banner2.png" alt="banner" class="banner">
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main>
|
||||||
<section>
|
<section>
|
||||||
<h2>Clan Stats</h2>
|
<h2>Clan Stats</h2>
|
||||||
<?php
|
<?php
|
||||||
include './config/config.php';
|
include './config/config.php';
|
||||||
|
|
||||||
// Load clan data from claninfo.json
|
// Load clan data from claninfo.json
|
||||||
$clanInfoPath = './data/claninfo.json';
|
$clanInfoPath = './data/claninfo.json';
|
||||||
|
$clanmembersfile = './config/clanmembers.json';
|
||||||
|
$clanmembers = json_decode(file_get_contents($clanmembersfile), true);
|
||||||
if (file_exists($clanInfoPath)) {
|
if (file_exists($clanInfoPath)) {
|
||||||
$clan = json_decode(file_get_contents($clanInfoPath), true);
|
$clan = json_decode(file_get_contents($clanInfoPath), true);
|
||||||
if (isset($clan) && !empty($clan)) {
|
if (isset($clan) && !empty($clan)) {
|
||||||
|
|
@ -29,6 +26,10 @@ error_reporting(E_ALL);
|
||||||
foreach ($clan as $key => $value) {
|
foreach ($clan as $key => $value) {
|
||||||
echo "<tr><td>" . htmlspecialchars($key) . "</td><td>" . htmlspecialchars($value) . "</td></tr>";
|
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>";
|
echo "</table>";
|
||||||
} else {
|
} else {
|
||||||
echo "<p>No clan attributes available</p>";
|
echo "<p>No clan attributes available</p>";
|
||||||
|
|
@ -36,11 +37,12 @@ error_reporting(E_ALL);
|
||||||
} else {
|
} else {
|
||||||
echo "<p>Clan info file missing</p>";
|
echo "<p>Clan info file missing</p>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<?php include './includes/footer.php'; ?>
|
<?php include './includes/footer.php'; ?>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -10,7 +10,6 @@
|
||||||
"SquadKiller101",
|
"SquadKiller101",
|
||||||
"Pettie1972",
|
"Pettie1972",
|
||||||
"HeteKip",
|
"HeteKip",
|
||||||
"Shepherders",
|
"Shepherders"
|
||||||
"WackyJacky101"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,10 @@ error_reporting(E_ALL);
|
||||||
|
|
||||||
$players_data = json_decode(file_get_contents('./data/player_lifetime_data.json'), true);
|
$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
|
// 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='solo' class='btn'>
|
||||||
<input type='submit' name='game_mode' value='duo' class='btn'>
|
<input type='submit' name='game_mode' value='duo' class='btn'>
|
||||||
<input type='submit' name='game_mode' value='squad' class='btn'>
|
<input type='submit' name='game_mode' value='squad' class='btn'>
|
||||||
|
|
@ -35,7 +35,7 @@ error_reporting(E_ALL);
|
||||||
</form><br>";
|
</form><br>";
|
||||||
|
|
||||||
// Buttons for each player
|
// Buttons for each player
|
||||||
echo "<form method='post' action=''>";
|
echo "<form method='get' action=''>";
|
||||||
foreach ($players_data[$selected_mode] as $player_name => $player_details) {
|
foreach ($players_data[$selected_mode] as $player_name => $player_details) {
|
||||||
echo "<button type='submit' name='selected_player' value='$player_name' class='btn' >$player_name</button>";
|
echo "<button type='submit' name='selected_player' value='$player_name' class='btn' >$player_name</button>";
|
||||||
|
|
||||||
|
|
@ -43,7 +43,7 @@ error_reporting(E_ALL);
|
||||||
echo "<input type='hidden' name='game_mode' value='$selected_mode'>";
|
echo "<input type='hidden' name='game_mode' value='$selected_mode'>";
|
||||||
echo "</form><br>";
|
echo "</form><br>";
|
||||||
|
|
||||||
$selected_player = $_POST['selected_player'] ?? array_key_first($players_data[$selected_mode]);
|
$selected_player = $_GET['selected_player'] ?? array_key_first($players_data[$selected_mode]);
|
||||||
|
|
||||||
// Fetch the player stats based on game mode and selected player
|
// Fetch the player stats based on game mode and selected player
|
||||||
if (isset($players_data[$selected_mode][$selected_player])) {
|
if (isset($players_data[$selected_mode][$selected_player])) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue