|
@@ -65,7 +65,7 @@ if (isset($_POST['add_new_game'])) {
|
|
|
$msg = "✅ Spiel erfolgreich angelegt!";
|
|
$msg = "✅ Spiel erfolgreich angelegt!";
|
|
|
} catch (PDOException $e) {
|
|
} catch (PDOException $e) {
|
|
|
if ($e->getCode() == 23000) {
|
|
if ($e->getCode() == 23000) {
|
|
|
- $msg = "❌ Fehler: Die EAN $ean existiert bereits!";
|
|
|
|
|
|
|
+ $msg = "❌ Fehler: EAN existiert bereits!";
|
|
|
$msg_type = "error";
|
|
$msg_type = "error";
|
|
|
} else { $msg = "Fehler: " . $e->getMessage(); }
|
|
} else { $msg = "Fehler: " . $e->getMessage(); }
|
|
|
}
|
|
}
|
|
@@ -74,17 +74,30 @@ if (isset($_POST['add_new_game'])) {
|
|
|
// Spiel updaten
|
|
// Spiel updaten
|
|
|
if (isset($_POST['update_game'])) {
|
|
if (isset($_POST['update_game'])) {
|
|
|
$stmt = $pdo->prepare("UPDATE spiele SET titel = ?, typ_id = ?, ean = ?, level = ?, bild_url = ? WHERE id = ?");
|
|
$stmt = $pdo->prepare("UPDATE spiele SET titel = ?, typ_id = ?, ean = ?, level = ?, bild_url = ? WHERE id = ?");
|
|
|
- $stmt->execute([
|
|
|
|
|
- $_POST['titel'],
|
|
|
|
|
- ($_POST['typ_id'] == '0' ? null : (int)$_POST['typ_id']),
|
|
|
|
|
- $_POST['ean'],
|
|
|
|
|
- $_POST['level'],
|
|
|
|
|
- $_POST['bild_url'],
|
|
|
|
|
- (int)$_POST['spiel_id']
|
|
|
|
|
- ]);
|
|
|
|
|
|
|
+ $stmt->execute([$_POST['titel'], ($_POST['typ_id'] == '0' ? null : (int)$_POST['typ_id']), $_POST['ean'], $_POST['level'], $_POST['bild_url'], (int)$_POST['spiel_id']]);
|
|
|
$msg = "💾 Änderungen gespeichert!";
|
|
$msg = "💾 Änderungen gespeichert!";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// NEU: Spiele-Typ hinzufügen
|
|
|
|
|
+if (isset($_POST['add_new_typ'])) {
|
|
|
|
|
+ $bez = trim($_POST['new_typ_bez']);
|
|
|
|
|
+ if(!empty($bez)) {
|
|
|
|
|
+ $pdo->prepare("INSERT INTO game_typen (bezeichnung) VALUES (?)")->execute([$bez]);
|
|
|
|
|
+ $msg = "✅ Neuer Typ '$bez' hinzugefügt!";
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// NEU: Spiele-Typ löschen
|
|
|
|
|
+if (isset($_POST['delete_typ'])) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ $pdo->prepare("DELETE FROM game_typen WHERE id = ?")->execute([(int)$_POST['typ_id']]);
|
|
|
|
|
+ $msg = "🗑 Typ gelöscht!";
|
|
|
|
|
+ } catch (Exception $e) {
|
|
|
|
|
+ $msg = "❌ Fehler: Typ wird noch von Spielen verwendet!";
|
|
|
|
|
+ $msg_type = "error";
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// Spiel löschen
|
|
// Spiel löschen
|
|
|
if (isset($_POST['delete_game'])) {
|
|
if (isset($_POST['delete_game'])) {
|
|
|
$pdo->prepare("DELETE FROM spiele WHERE id = ?")->execute([(int)$_POST['spiel_id']]);
|
|
$pdo->prepare("DELETE FROM spiele WHERE id = ?")->execute([(int)$_POST['spiel_id']]);
|
|
@@ -114,13 +127,13 @@ $spieler = $pdo->query("SELECT * FROM spieler ORDER BY name ASC")->fetchAll();
|
|
|
}
|
|
}
|
|
|
.dark-theme {
|
|
.dark-theme {
|
|
|
--bg: #121212cf; --card: #1e1e1e; --text: #e0e0e0; --border: #333;
|
|
--bg: #121212cf; --card: #1e1e1e; --text: #e0e0e0; --border: #333;
|
|
|
- --header-bg: #252525; --input-bg: #2a2a2a; --unknown-bg: #4d2b00;
|
|
|
|
|
|
|
+ --header-bg: #252525; --header-text: #e67e22; --input-bg: #2a2a2a; --unknown-bg: #4d2b00;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
body { font-family: 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); padding: 20px; transition: 0.3s; }
|
|
body { font-family: 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); padding: 20px; transition: 0.3s; }
|
|
|
.container { max-width: 1500px; margin: 0 auto; }
|
|
.container { max-width: 1500px; margin: 0 auto; }
|
|
|
|
|
|
|
|
- .tab-nav { display: flex; gap: 10px; margin-bottom: 20px; border-bottom: 2px solid var(--border); padding-bottom: 10px; }
|
|
|
|
|
|
|
+ .tab-nav { display: flex; gap: 10px; margin-bottom: 20px; border-bottom: 2px solid var(--border); padding-bottom: 10px; flex-wrap: wrap; }
|
|
|
.tab-btn { padding: 10px 20px; border: none; background: none; color: var(--text); cursor: pointer; font-weight: bold; border-radius: 8px; transition: 0.2s; }
|
|
.tab-btn { padding: 10px 20px; border: none; background: none; color: var(--text); cursor: pointer; font-weight: bold; border-radius: 8px; transition: 0.2s; }
|
|
|
.tab-btn.active { background: var(--accent); color: white; }
|
|
.tab-btn.active { background: var(--accent); color: white; }
|
|
|
.tab-content { display: none; }
|
|
.tab-content { display: none; }
|
|
@@ -129,10 +142,10 @@ $spieler = $pdo->query("SELECT * FROM spieler ORDER BY name ASC")->fetchAll();
|
|
|
.admin-card { background: var(--card); padding: 20px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); margin-bottom: 30px; border: 1px solid var(--border); }
|
|
.admin-card { background: var(--card); padding: 20px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); margin-bottom: 30px; border: 1px solid var(--border); }
|
|
|
.alert { padding: 15px; border-radius: 8px; margin-bottom: 20px; font-weight: bold; text-align: center; border: 1px solid transparent; }
|
|
.alert { padding: 15px; border-radius: 8px; margin-bottom: 20px; font-weight: bold; text-align: center; border: 1px solid transparent; }
|
|
|
.alert-success { background: #d4edda; color: #155724; border-color: #c3e6cb; }
|
|
.alert-success { background: #d4edda; color: #155724; border-color: #c3e6cb; }
|
|
|
- .dark-theme .alert-success { background: #1b4332; color: #74c69d; }
|
|
|
|
|
|
|
+ .alert-error { background: #f8d7da; color: #721c24; border-color: #f5c6cb; }
|
|
|
|
|
|
|
|
table { width: 100%; border-collapse: collapse; margin-top: 10px; background: var(--card); }
|
|
table { width: 100%; border-collapse: collapse; margin-top: 10px; background: var(--card); }
|
|
|
- th { background: var(--header-bg); padding: 12px; text-align: left; font-size: 0.85em; border-bottom: 2px solid var(--border); }
|
|
|
|
|
|
|
+ th { background: var(--header-bg); padding: 12px; text-align: left; font-size: 0.85em; border-bottom: 2px solid var(--border); color: var(--text); }
|
|
|
td { padding: 10px; border-bottom: 1px solid var(--border); }
|
|
td { padding: 10px; border-bottom: 1px solid var(--border); }
|
|
|
|
|
|
|
|
input, select { padding: 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--input-bg); color: var(--text); width: 100%; box-sizing: border-box; }
|
|
input, select { padding: 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--input-bg); color: var(--text); width: 100%; box-sizing: border-box; }
|
|
@@ -166,7 +179,8 @@ $spieler = $pdo->query("SELECT * FROM spieler ORDER BY name ASC")->fetchAll();
|
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
<div class="tab-nav">
|
|
<div class="tab-nav">
|
|
|
- <button class="tab-btn active" onclick="openTab(event, 'games')">🎮 Spiele verwalten</button>
|
|
|
|
|
|
|
+ <button class="tab-btn active" onclick="openTab(event, 'games')">🎮 Spiele</button>
|
|
|
|
|
+ <button class="tab-btn" onclick="openTab(event, 'typen')">🏷 Spieletypen</button>
|
|
|
<button class="tab-btn" onclick="openTab(event, 'players')">👥 Spieler / Teams</button>
|
|
<button class="tab-btn" onclick="openTab(event, 'players')">👥 Spieler / Teams</button>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
@@ -207,7 +221,7 @@ $spieler = $pdo->query("SELECT * FROM spieler ORDER BY name ASC")->fetchAll();
|
|
|
</tr>
|
|
</tr>
|
|
|
</thead>
|
|
</thead>
|
|
|
<tbody>
|
|
<tbody>
|
|
|
- <?php foreach ($spiele as $sp): $is_unknown = ($sp['level'] == 'Unknown' || empty($sp['level'])); ?>
|
|
|
|
|
|
|
+ <?php foreach ($spiele as $sp): ?>
|
|
|
<tr>
|
|
<tr>
|
|
|
<form method="POST">
|
|
<form method="POST">
|
|
|
<input type="hidden" name="spiel_id" value="<?= $sp['id'] ?>">
|
|
<input type="hidden" name="spiel_id" value="<?= $sp['id'] ?>">
|
|
@@ -223,8 +237,8 @@ $spieler = $pdo->query("SELECT * FROM spieler ORDER BY name ASC")->fetchAll();
|
|
|
</select>
|
|
</select>
|
|
|
</td>
|
|
</td>
|
|
|
<td>
|
|
<td>
|
|
|
- <select name="level" class="<?= $is_unknown ? 'lvl-unknown' : '' ?>">
|
|
|
|
|
- <option value="Unknown" <?= $is_unknown ? 'selected' : '' ?>>Unbekannt</option>
|
|
|
|
|
|
|
+ <select name="level">
|
|
|
|
|
+ <option value="Unknown" <?= ($sp['level']=='Unknown' || empty($sp['level']))?'selected':'' ?>>Unbekannt</option>
|
|
|
<option value="Einsteiger" <?= $sp['level']=='Einsteiger'?'selected':'' ?>>Einsteiger</option>
|
|
<option value="Einsteiger" <?= $sp['level']=='Einsteiger'?'selected':'' ?>>Einsteiger</option>
|
|
|
<option value="Fortgeschrittene" <?= $sp['level']=='Fortgeschrittene'?'selected':'' ?>>Fortgeschrittene</option>
|
|
<option value="Fortgeschrittene" <?= $sp['level']=='Fortgeschrittene'?'selected':'' ?>>Fortgeschrittene</option>
|
|
|
<option value="Profi" <?= $sp['level']=='Profi'?'selected':'' ?>>Profi</option>
|
|
<option value="Profi" <?= $sp['level']=='Profi'?'selected':'' ?>>Profi</option>
|
|
@@ -243,16 +257,41 @@ $spieler = $pdo->query("SELECT * FROM spieler ORDER BY name ASC")->fetchAll();
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
- <div id="players" class="tab-content">
|
|
|
|
|
|
|
+ <div id="typen" class="tab-content">
|
|
|
<div class="admin-card">
|
|
<div class="admin-card">
|
|
|
- <h3>👥 Vorhandene Spieler / Teams</h3>
|
|
|
|
|
|
|
+ <h3>🏷 Spieletypen verwalten</h3>
|
|
|
|
|
+ <form method="POST" style="display:flex; gap:10px; margin-bottom:20px;">
|
|
|
|
|
+ <input type="text" name="new_typ_bez" placeholder="z.B. Adventure Games" required>
|
|
|
|
|
+ <button type="submit" name="add_new_typ" class="btn btn-add" style="margin:0; width:auto;">Hinzufügen</button>
|
|
|
|
|
+ </form>
|
|
|
<table>
|
|
<table>
|
|
|
<thead>
|
|
<thead>
|
|
|
|
|
+ <tr><th>ID</th><th>Bezeichnung</th><th style="width:100px;">Aktion</th></tr>
|
|
|
|
|
+ </thead>
|
|
|
|
|
+ <tbody>
|
|
|
|
|
+ <?php foreach ($typen as $t): ?>
|
|
|
<tr>
|
|
<tr>
|
|
|
- <th>ID</th>
|
|
|
|
|
- <th>Name</th>
|
|
|
|
|
- <th style="width:100px;">Aktion</th>
|
|
|
|
|
|
|
+ <td>#<?= $t['id'] ?></td>
|
|
|
|
|
+ <td><strong><?= htmlspecialchars($t['bezeichnung']) ?></strong></td>
|
|
|
|
|
+ <td>
|
|
|
|
|
+ <form method="POST" onsubmit="return confirm('Typ löschen?')">
|
|
|
|
|
+ <input type="hidden" name="typ_id" value="<?= $t['id'] ?>">
|
|
|
|
|
+ <button type="submit" name="delete_typ" class="btn btn-del">Löschen</button>
|
|
|
|
|
+ </form>
|
|
|
|
|
+ </td>
|
|
|
</tr>
|
|
</tr>
|
|
|
|
|
+ <?php endforeach; ?>
|
|
|
|
|
+ </tbody>
|
|
|
|
|
+ </table>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div id="players" class="tab-content">
|
|
|
|
|
+ <div class="admin-card">
|
|
|
|
|
+ <h3>👥 Vorhandene Spieler / Teams</h3>
|
|
|
|
|
+ <table>
|
|
|
|
|
+ <thead>
|
|
|
|
|
+ <tr><th>ID</th><th>Name</th><th style="width:100px;">Aktion</th></tr>
|
|
|
</thead>
|
|
</thead>
|
|
|
<tbody>
|
|
<tbody>
|
|
|
<?php foreach ($spieler as $p): ?>
|
|
<?php foreach ($spieler as $p): ?>
|
|
@@ -273,8 +312,6 @@ $spieler = $pdo->query("SELECT * FROM spieler ORDER BY name ASC")->fetchAll();
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
-<button id="scrollToTop" onclick="window.scrollTo(0,0);">▲</button>
|
|
|
|
|
-
|
|
|
|
|
<script>
|
|
<script>
|
|
|
function openTab(evt, tabName) {
|
|
function openTab(evt, tabName) {
|
|
|
let i, content, btns;
|
|
let i, content, btns;
|
|
@@ -301,10 +338,6 @@ $spieler = $pdo->query("SELECT * FROM spieler ORDER BY name ASC")->fetchAll();
|
|
|
const msg = document.getElementById('msg-box');
|
|
const msg = document.getElementById('msg-box');
|
|
|
if(msg) { msg.style.transition = 'opacity 0.5s'; msg.style.opacity = '0'; }
|
|
if(msg) { msg.style.transition = 'opacity 0.5s'; msg.style.opacity = '0'; }
|
|
|
}, 3000);
|
|
}, 3000);
|
|
|
-
|
|
|
|
|
- window.onscroll = function() {
|
|
|
|
|
- document.getElementById("scrollToTop").style.display = (window.scrollY > 300) ? "block" : "none";
|
|
|
|
|
- };
|
|
|
|
|
</script>
|
|
</script>
|
|
|
</body>
|
|
</body>
|
|
|
</html>
|
|
</html>
|