diff --git a/index.html b/index.html index df7090a..4cbc851 100644 --- a/index.html +++ b/index.html @@ -123,12 +123,13 @@ class GuestbookManager { public function deleteEntry($index) { if (isset($this->entries[$index])) { unset($this->entries[$index]); - $this->entries = array_values($this->entries); // Re-index the array + $this->entries = array_values($this->entries); // Re-indizieren des Arrays $this->saveEntries(); return true; } return false; } + private function saveEntries() { @@ -154,13 +155,14 @@ public function displayEntries($isAdmin = false) {

{$entry['name']}

{$entry['message']}

{$entry['date']}"; - if ($isAdmin) { - $output .= "
- - -
"; - } - $output .= ""; + if ($isAdmin) { + $output .= "
+ + + +
"; + } + } $output .= ''; return $output; @@ -305,14 +307,17 @@ class AdminManager { return $output; } - public function displayGalleryImages() { - $output = ''; + public function displayGalleryImages() { + $output = ''; return $output; } + @@ -355,6 +360,19 @@ if (isset($_GET['action'])) { break; } } +if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'delete_guestbook') { + if ($adminManager->isAdmin() && isset($_POST['delete_entry'])) { + $index = $_POST['delete_entry']; + if ($guestbookManager->deleteEntry($index)) { + $_SESSION['message'] = "Eintrag erfolgreich gelöscht."; + } else { + $_SESSION['error'] = "Fehler beim Löschen des Eintrags."; + } + // Umleitung zur gleichen Seite, um Neuladen des Formulars zu verhindern + header("Location: " . $_SERVER['PHP_SELF'] . "#guestbook"); + exit(); + } +} if ($_SERVER['REQUEST_METHOD'] === 'POST') { @@ -367,19 +385,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { } elseif (isset($_POST['update-social-media'])) { $adminManager->handleSocialMediaUpdate($_POST['social-platform'], $_POST['social-url']); - if (isset($_POST['delete_entry']) && $adminManager->isAdmin()) { - $index = $_POST['delete_entry']; - if ($guestbookManager->deleteEntry($index)) { - // Optionally set a success message - $_SESSION['message'] = "Eintrag erfolgreich gelöscht."; - } else { - // Optionally set an error message - $_SESSION['error'] = "Fehler beim Löschen des Eintrags."; - } - // Redirect to prevent form resubmission - header("Location: " . $_SERVER['PHP_SELF'] . "#guestbook"); - exit(); - } } elseif (isset($_FILES["fileToUpload"]) && $adminManager->isAdmin()) { $adminManager->handleImageUpload($_FILES["fileToUpload"]); @@ -741,15 +746,101 @@ footer { #currentTime { font-family: monospace; } + + + + + + + +.modal { + display: none; + position: fixed; + z-index: 1000; + padding-top: 100px; + left: 0; + top: 0; + width: 100%; + height: 100%; + overflow: auto; + background-color: rgba(0,0,0,0.9); +} + +.modal-content { + margin: auto; + display: block; + width: 80%; + max-width: 700px; +} + +#caption { + margin: auto; + display: block; + width: 80%; + max-width: 700px; + text-align: center; + color: #ccc; + padding: 10px 0; + height: 150px; +} + +.close { + position: absolute; + top: 15px; + right: 35px; + color: #f1f1f1; + font-size: 40px; + font-weight: bold; + transition: 0.3s; +} + +.close:hover, +.close:focus { + color: #bbb; + text-decoration: none; + cursor: pointer; +} + +.download-btn { + display: block; + width: 200px; + height: 40px; + margin: 10px auto; + background-color: #4CAF50; + color: white; + text-align: center; + line-height: 40px; + text-decoration: none; + border-radius: 5px; +} + +.download-btn:hover { + background-color: #45a049; +} + + + + + + + + + + + + + + + @@ -1057,6 +1148,42 @@ function generateQRCode() { + + + + + + + + +