diff --git a/admin.php b/admin.php
index e2c70f7..22f6fdd 100644
--- a/admin.php
+++ b/admin.php
@@ -522,6 +522,7 @@ $current_session_user = isset($_SESSION['user']) ? (string) $_SESSION['user'] :
WEBHOOK
NOTIF DISCORD
Base d'Objets
+ Stats Item
Scanner Minage
Manufactures
Vaisseaux
diff --git a/db/scstatsitem.php b/db/scstatsitem.php
new file mode 100644
index 0000000..500ff26
--- /dev/null
+++ b/db/scstatsitem.php
@@ -0,0 +1,32 @@
+exec(
+ "CREATE TABLE IF NOT EXISTS tbl_scstatsitem (
+ cl_scstatsitem_id INT(11) NOT NULL AUTO_INCREMENT,
+ cl_scstatsitem_name VARCHAR(255) NOT NULL,
+ cl_scstatsitem_unit VARCHAR(10) NOT NULL DEFAULT '%',
+ cl_scstatsitem_created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (cl_scstatsitem_id),
+ UNIQUE KEY uq_scstatsitem_name (cl_scstatsitem_name)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci"
+ );
+
+ $columns_stmt = $db->query("SHOW COLUMNS FROM tbl_scstatsitem LIKE 'cl_scstatsitem_unit'");
+ $has_unit = (bool) $columns_stmt->fetch();
+ if (!$has_unit) {
+ $db->exec("ALTER TABLE tbl_scstatsitem ADD COLUMN cl_scstatsitem_unit VARCHAR(10) NOT NULL DEFAULT '%' AFTER cl_scstatsitem_name");
+ }
+
+ $bootstrapped = true;
+}
diff --git a/scitems.php b/scitems.php
index 206da14..151be58 100644
--- a/scitems.php
+++ b/scitems.php
@@ -404,6 +404,7 @@ if ($edit_id > 0) {
WEBHOOK
NOTIF DISCORD
Base d'Objets
+ Stats Item
Scanner Minage
Manufactures
Vaisseaux
@@ -484,7 +485,7 @@ if ($edit_id > 0) {
- Reset
+ Reset
diff --git a/scmanufactures.php b/scmanufactures.php
index 937a29d..75f9d19 100644
--- a/scmanufactures.php
+++ b/scmanufactures.php
@@ -275,7 +275,8 @@ $current_session_user = $_SESSION['user'] ?? '';
Utilisateurs
WEBHOOK
NOTIF DISCORD
- Base d\'Objets
+ Base d'Objets
+ Stats Item
Scanner Minage
Manufactures
Vaisseaux
diff --git a/scmining.php b/scmining.php
index 5a1b03d..6b4933f 100644
--- a/scmining.php
+++ b/scmining.php
@@ -333,6 +333,7 @@ $current_session_user = $_SESSION['user'] ?? '';
WEBHOOK
NOTIF DISCORD
Base d'Objets
+ Stats Item
Scanner Minage
Manufactures
Vaisseaux
diff --git a/scnotification.php b/scnotification.php
index 5cfd8c7..075d567 100644
--- a/scnotification.php
+++ b/scnotification.php
@@ -675,6 +675,7 @@ function scnotification_old_checked(array $old, string $key, bool $default = fal
WEBHOOK
NOTIF DISCORD
Base d'Objets
+ Stats Item
Scanner Minage
Manufactures
Vaisseaux
diff --git a/scpreset.php b/scpreset.php
index d34dc66..2300067 100644
--- a/scpreset.php
+++ b/scpreset.php
@@ -327,7 +327,8 @@ $presets = $stmt_list->fetchAll();
Utilisateurs
WEBHOOK
NOTIF DISCORD
- Base d\'Objets
+ Base d'Objets
+ Stats Item
Scanner Minage
Manufactures
Vaisseaux
diff --git a/scstatsitem.php b/scstatsitem.php
new file mode 100644
index 0000000..aba258b
--- /dev/null
+++ b/scstatsitem.php
@@ -0,0 +1,496 @@
+prepare('INSERT INTO tbl_scstatsitem (cl_scstatsitem_name, cl_scstatsitem_unit) VALUES (:name, :unit)');
+ $stmt->execute([
+ 'name' => $name,
+ 'unit' => $unit,
+ ]);
+ auth_flash_set('success', 'Statistique ajoutée avec succès.');
+ } catch (PDOException $e) {
+ if ($e->getCode() == 23000) {
+ auth_flash_set('error', 'Cette statistique existe déjà.');
+ } else {
+ auth_flash_set('error', 'Erreur lors de l\'ajout : ' . $e->getMessage());
+ }
+ }
+ }
+
+ header('Location: scstatsitem.php');
+ exit;
+ }
+
+ if ($action === 'update_stat') {
+ $id = (int) ($_POST['stat_id'] ?? 0);
+ $name = trim($_POST['name'] ?? '');
+ $unit = trim($_POST['unit'] ?? '%');
+ if (!in_array($unit, $allowed_units, true)) {
+ $unit = '%';
+ }
+
+ if ($id <= 0 || $name === '') {
+ auth_flash_set('error', 'Données invalides.');
+ } else {
+ try {
+ $stmt = $db->prepare('UPDATE tbl_scstatsitem SET cl_scstatsitem_name = :name, cl_scstatsitem_unit = :unit WHERE cl_scstatsitem_id = :id');
+ $stmt->execute([
+ 'name' => $name,
+ 'unit' => $unit,
+ 'id' => $id,
+ ]);
+ auth_flash_set('success', 'Statistique mise à jour.');
+ } catch (PDOException $e) {
+ if ($e->getCode() == 23000) {
+ auth_flash_set('error', 'Cette statistique existe déjà.');
+ } else {
+ auth_flash_set('error', 'Erreur lors de la mise à jour : ' . $e->getMessage());
+ }
+ }
+ }
+
+ header('Location: scstatsitem.php');
+ exit;
+ }
+
+ if ($action === 'delete_stat') {
+ $id = (int) ($_POST['stat_id'] ?? 0);
+
+ if ($id > 0) {
+ try {
+ $stmt = $db->prepare('DELETE FROM tbl_scstatsitem WHERE cl_scstatsitem_id = :id');
+ $stmt->execute(['id' => $id]);
+ auth_flash_set('success', 'Statistique supprimée.');
+ } catch (PDOException $e) {
+ auth_flash_set('error', 'Erreur lors de la suppression : ' . $e->getMessage());
+ }
+ }
+
+ header('Location: scstatsitem.php');
+ exit;
+ }
+}
+
+$stmt_stats = $db->query('SELECT * FROM tbl_scstatsitem ORDER BY cl_scstatsitem_name ASC, cl_scstatsitem_id ASC');
+$stats_items = $stmt_stats->fetchAll();
+
+$current_session_user = $_SESSION['user'] ?? '';
+?>
+
+
+
+
+
+ Stats Item | R.E.A.C.T. Admin
+
+
+
+
+
+
+
+
+
+
diff --git a/scvaisseaux.php b/scvaisseaux.php
index c2b1975..f3daac7 100644
--- a/scvaisseaux.php
+++ b/scvaisseaux.php
@@ -286,7 +286,8 @@ $current_session_user = $_SESSION['user'] ?? '';
Utilisateurs
WEBHOOK
NOTIF DISCORD
- Base d\'Objets
+ Base d'Objets
+ Stats Item
Scanner Minage
Manufactures
Vaisseaux
diff --git a/scwebhook.php b/scwebhook.php
index cb9a4c2..8b551e1 100644
--- a/scwebhook.php
+++ b/scwebhook.php
@@ -552,6 +552,7 @@ $banners = $stmt_banners->fetchAll();
WEBHOOK
NOTIF DISCORD
Base d'Objets
+ Stats Item
Scanner Minage
Manufactures
Vaisseaux