Răsfoiți Sursa

"Unbekannt"-Logik eingebaut

erdo 2 zile în urmă
părinte
comite
c946b99ab2
1 a modificat fișierele cu 14 adăugiri și 8 ștergeri
  1. 14 8
      index.php

+ 14 - 8
index.php

@@ -1,6 +1,5 @@
 <?php
 <?php
-include 'db_config.php'; // Falls du die Connection auslagerst, sonst Code von oben kopieren
-
+include 'db_config.php';
 
 
 // --- LOGIK: NEUEN SPIELER HINZUFÜGEN ---
 // --- LOGIK: NEUEN SPIELER HINZUFÜGEN ---
 if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_player'])) {
 if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_player'])) {
@@ -58,14 +57,17 @@ $allScores = $pdo->query($sqlScores)->fetchAll();
         .card img { width: 100%; height: 180px; object-fit: cover; opacity: 0.7; }
         .card img { width: 100%; height: 180px; object-fit: cover; opacity: 0.7; }
         .content { padding: 15px; }
         .content { padding: 15px; }
         
         
+        h1 { color: #e67e22; }
         h2 { color: #e67e22; margin-top: 0; font-size: 1.2em; }
         h2 { color: #e67e22; margin-top: 0; font-size: 1.2em; }
         .stats { width: 100%; border-collapse: collapse; font-size: 0.85em; }
         .stats { width: 100%; border-collapse: collapse; font-size: 0.85em; }
         .stats td { padding: 6px 0; border-bottom: 1px solid #2a2a2a; }
         .stats td { padding: 6px 0; border-bottom: 1px solid #2a2a2a; }
         
         
-        .badge { padding: 4px 8px; border-radius: 4px; font-size: 0.7em; font-weight: bold; text-transform: uppercase; }
+        /* Badges inkl. Unbekannt-Logik */
+        .badge { padding: 4px 8px; border-radius: 4px; font-size: 0.7em; font-weight: bold; text-transform: uppercase; color: white; display: inline-block; margin-bottom: 5px; }
         .level-Einsteiger { background: #27ae60; } 
         .level-Einsteiger { background: #27ae60; } 
         .level-Profi { background: #c0392b; } 
         .level-Profi { background: #c0392b; } 
         .level-Fortgeschrittene { background: #2980b9; }
         .level-Fortgeschrittene { background: #2980b9; }
+        .level-unknown { background: #f39c12; } /* Gelb/Orange für Unbekannt */
 
 
         .bottom-section { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; margin-top: 20px; }
         .bottom-section { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; margin-top: 20px; }
         @media (max-width: 768px) { .bottom-section { grid-template-columns: 1fr; } }
         @media (max-width: 768px) { .bottom-section { grid-template-columns: 1fr; } }
@@ -76,7 +78,6 @@ $allScores = $pdo->query($sqlScores)->fetchAll();
         input, select { width: 100%; padding: 10px; background: #2a2a2a; border: 1px solid #444; color: white; border-radius: 5px; box-sizing: border-box; margin-bottom: 10px; }
         input, select { width: 100%; padding: 10px; background: #2a2a2a; border: 1px solid #444; color: white; border-radius: 5px; box-sizing: border-box; margin-bottom: 10px; }
         button { background: #e67e22; color: white; border: none; padding: 12px; border-radius: 5px; cursor: pointer; font-weight: bold; width: 100%; }
         button { background: #e67e22; color: white; border: none; padding: 12px; border-radius: 5px; cursor: pointer; font-weight: bold; width: 100%; }
 
 
-        /* Footer Navigation */
         .footer-nav { position: fixed; bottom: 0; left: 0; width: 100%; background: #1a1a1a; border-top: 2px solid #e67e22; padding: 15px 0; display: flex; justify-content: center; gap: 20px; z-index: 1000; flex-wrap: wrap; }
         .footer-nav { position: fixed; bottom: 0; left: 0; width: 100%; background: #1a1a1a; border-top: 2px solid #e67e22; padding: 15px 0; display: flex; justify-content: center; gap: 20px; z-index: 1000; flex-wrap: wrap; }
         .footer-nav a { color: #e67e22; text-decoration: none; font-weight: bold; font-size: 0.85em; padding: 5px 10px; border: 1px solid transparent; transition: 0.3s; }
         .footer-nav a { color: #e67e22; text-decoration: none; font-weight: bold; font-size: 0.85em; padding: 5px 10px; border: 1px solid transparent; transition: 0.3s; }
         .footer-nav a:hover { border-color: #e67e22; border-radius: 5px; }
         .footer-nav a:hover { border-color: #e67e22; border-radius: 5px; }
@@ -95,12 +96,16 @@ $allScores = $pdo->query($sqlScores)->fetchAll();
 
 
     <div class="swiper mySwiper">
     <div class="swiper mySwiper">
         <div class="swiper-wrapper">
         <div class="swiper-wrapper">
-            <?php foreach ($exitGames as $game): ?>
+            <?php foreach ($exitGames as $game): 
+                // Logik für unbekanntes Level
+                $lvl_class = (empty($game['level']) || strtolower($game['level']) == 'unknown') ? 'unknown' : $game['level'];
+                $lvl_display = ($lvl_class == 'unknown') ? 'Unbekannt' : $game['level'];
+            ?>
                 <div class="swiper-slide">
                 <div class="swiper-slide">
                     <div class="card">
                     <div class="card">
-                        <img src="<?= htmlspecialchars($game['bild_url']) ?>" alt="Cover">
+                        <img src="<?= htmlspecialchars($game['bild_url']) ?>" alt="Cover" onerror="this.src='https://via.placeholder.com/320x180?text=Kein+Bild'">
                         <div class="content">
                         <div class="content">
-                            <span class="badge level-<?= $game['level'] ?>"><?= $game['level'] ?></span>
+                            <span class="badge level-<?= $lvl_class ?>"><?= htmlspecialchars($lvl_display) ?></span>
                             <h2><?= htmlspecialchars($game['titel']) ?></h2>
                             <h2><?= htmlspecialchars($game['titel']) ?></h2>
                             <table class="stats">
                             <table class="stats">
                                 <?php 
                                 <?php 
@@ -158,7 +163,8 @@ $allScores = $pdo->query($sqlScores)->fetchAll();
 
 
 <div class="footer-nav">
 <div class="footer-nav">
     <a href="javascript:void(0)" onclick="toggleModal()">👤 NEUER SPIELER</a>
     <a href="javascript:void(0)" onclick="toggleModal()">👤 NEUER SPIELER</a>
-    <a href="besitz.php">📦 BESTAND PFLEGEN</a> <a href="gesamtliste.php">📝 GESAMTÜBERSICHT</a>
+    <a href="besitz.php">📦 BESTAND PFLEGEN</a> 
+    <a href="gesamtliste.php">📝 GESAMTÜBERSICHT</a>
     <a href="admin.php">🛠 ADMIN</a>
     <a href="admin.php">🛠 ADMIN</a>
 </div>
 </div>