diff --git a/index.html b/index.html index 862cfb6..a5e2321 100644 --- a/index.html +++ b/index.html @@ -105,6 +105,17 @@ 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->saveEntries(); + return true; + } + return false; + } + + private function saveEntries() { file_put_contents($this->dbFile, json_encode($this->entries)); } @@ -120,20 +131,27 @@ class GuestbookManager { '; } - - public function displayEntries() { - $output = '
{$entry['message']}
- {$entry['date']} -{$entry['message']}
+ {$entry['date']}"; + if ($isAdmin) { + $output .= ""; } - $output .= '