120 lines
6.3 KiB
PHP
120 lines
6.3 KiB
PHP
<?php
|
|
require_once 'db/config.php';
|
|
$db = db();
|
|
|
|
// MJ Actions
|
|
if (isset($_POST['reset_world'])) {
|
|
$db->exec("UPDATE cities SET current_red_percentage = 100, is_liberated = 0");
|
|
$db->exec("UPDATE planets SET terrestrial_control = 0, status = 'hostile'");
|
|
header("Location: admin.php?success=reset");
|
|
exit;
|
|
}
|
|
|
|
$total_planets = $db->query("SELECT COUNT(*) FROM planets")->fetchColumn();
|
|
$liberated_planets = $db->query("SELECT COUNT(*) FROM planets WHERE status = 'stable'")->fetchColumn();
|
|
$total_cities = $db->query("SELECT COUNT(*) FROM cities")->fetchColumn();
|
|
$liberated_cities = $db->query("SELECT COUNT(*) FROM cities WHERE is_liberated = 1")->fetchColumn();
|
|
|
|
$planets_stats = $db->query("SELECT * FROM planets ORDER BY terrestrial_control DESC")->fetchAll();
|
|
|
|
// Mock Resources
|
|
$resources = [
|
|
'Metal' => ['val' => '136 053', 'max' => '1 210 000', 'prod' => '+1 980', 'icon' => 'fa-cube'],
|
|
'Crystal' => ['val' => '127 322', 'max' => '1 010 000', 'prod' => '+1 703', 'icon' => 'fa-gem'],
|
|
'Deuterium' => ['val' => '32 277', 'max' => '50 000', 'prod' => '+28', 'icon' => 'fa-flask'],
|
|
'Energy' => ['val' => '2 100', 'max' => '2 100', 'prod' => '', 'icon' => 'fa-bolt'],
|
|
'Dark Matter' => ['val' => '4 930', 'max' => '', 'prod' => '', 'icon' => 'fa-atom']
|
|
];
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Console MJ</title>
|
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
|
|
<link href="assets/css/custom.css?v=<?php echo time(); ?>" rel="stylesheet">
|
|
<style>
|
|
body { background: #000; color: #fff; font-family: Arial, sans-serif; }
|
|
header#top-bar { height: auto; padding: 10px; background: rgba(10, 15, 30, 0.9); border-bottom: 2px solid #2d3545; display: flex; justify-content: center; align-items: center; }
|
|
.resource-container { display: flex; gap: 10px; flex-wrap: wrap; }
|
|
.resource-box { background: #0a0a0a; border: 1px solid #3b4252; padding: 5px 15px; text-align: left; min-width: 140px; position: relative; }
|
|
.resource-box i { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); opacity: 0.3; font-size: 20px; }
|
|
.resource-name { font-size: 10px; color: #8c92a3; text-transform: uppercase; }
|
|
.resource-value { font-size: 13px; font-weight: bold; color: #fff; }
|
|
|
|
#main-content { padding: 40px; display: flex; flex-direction: column; align-items: center; }
|
|
.view-frame { background: rgba(20, 30, 50, 0.8); border: 1px solid #4c566a; padding: 30px; max-width: 1000px; width: 100%; }
|
|
|
|
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
|
|
th, td { border: 1px solid #2d3545; padding: 10px; text-align: left; font-size: 12px; }
|
|
th { background: #1e293b; color: #8c92a3; text-transform: uppercase; font-size: 10px; }
|
|
.stat-card { background: #0a0a0a; border: 1px solid #2d3545; padding: 15px; margin-bottom: 20px; }
|
|
|
|
.btn-danger { background: #bf616a; border: none; color: white; padding: 10px 20px; cursor: pointer; font-weight: bold; text-transform: uppercase; }
|
|
.btn-danger:hover { background: #d08770; }
|
|
.back-link { display: inline-block; margin-bottom: 20px; color: #88c0d0; text-decoration: none; font-weight: bold; }
|
|
.back-link:hover { text-decoration: underline; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<header id="top-bar">
|
|
<div class="resource-container">
|
|
<?php foreach($resources as $name => $res): ?>
|
|
<div class="resource-box">
|
|
<div class="resource-name"><?php echo $name; ?></div>
|
|
<div class="resource-value"><?php echo $res['val']; ?></div>
|
|
<i class="fa-solid <?php echo $res['icon']; ?>"></i>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</header>
|
|
|
|
<main id="main-content">
|
|
<div class="view-frame">
|
|
<a href="index.php" class="back-link"><i class="fa-solid fa-arrow-left"></i> Retour au Secteur</a>
|
|
<h2 class="text-accent" style="margin-top: 0; color: #88c0d0;">Console de Commandement MJ</h2>
|
|
|
|
<div style="display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px;">
|
|
<div class="stat-card">
|
|
<div class="text-muted small">Planètes Libérées</div>
|
|
<div class="text-success" style="font-size: 20px; font-weight: bold; color: #a3be8c;"><?php echo $liberated_planets; ?> / <?php echo $total_planets; ?></div>
|
|
</div>
|
|
<div class="stat-card">
|
|
<div class="text-muted small">Villes Libérées</div>
|
|
<div class="text-success" style="font-size: 20px; font-weight: bold; color: #a3be8c;"><?php echo $liberated_cities; ?> / <?php echo $total_cities; ?></div>
|
|
</div>
|
|
<div class="stat-card">
|
|
<form method="POST" onsubmit="return confirm('Wipe total ?');">
|
|
<button type="submit" name="reset_world" class="btn-danger">RÉINITIALISER L'UNIVERS</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Planète</th>
|
|
<th>Type</th>
|
|
<th>Statut</th>
|
|
<th>Contrôle Sol</th>
|
|
<th>Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($planets_stats as $p): ?>
|
|
<tr>
|
|
<td><?php echo $p['name']; ?></td>
|
|
<td><?php echo strtoupper($p['type'] ?? 'PLANET'); ?></td>
|
|
<td style="color: <?php echo ($p['status'] == 'stable' ? '#a3be8c' : '#bf616a'); ?>"><?php echo strtoupper($p['status']); ?></td>
|
|
<td><?php echo $p['terrestrial_control']; ?>%</td>
|
|
<td><a href="index.php?galaxy_id=<?php echo $p['galaxy_id'] ?? 1; ?>§or_id=<?php echo $p['sector_id']; ?>" style="color: #88c0d0; text-decoration: none;">Localiser</a></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</main>
|
|
</body>
|
|
</html>
|