diff --git a/index.html b/index.html index 2657433..6251bcb 100644 --- a/index.html +++ b/index.html @@ -1,3 +1,208 @@ +'; + } + + public function getJavaScript() { + return " + document.addEventListener('DOMContentLoaded', function () { + var video = document.getElementById('webcam-player'); + var videoSrc = '{$this->videoSrc}'; + if (Hls.isSupported()) { + var hls = new Hls(); + hls.loadSource(videoSrc); + hls.attachMedia(video); + hls.on(Hls.Events.MANIFEST_PARSED, function () { + video.play(); + }); + } + else if (video.canPlayType('application/vnd.apple.mpegurl')) { + video.src = videoSrc; + video.addEventListener('loadedmetadata', function () { + video.play(); + }); + } + }); + "; + } + + public function setVideoSrc($src) { + $this->videoSrc = $src; + } +} + +class GuestbookManager { + private $entries = []; + private $dbFile = 'guestbook.json'; + + public function __construct() { + if (file_exists($this->dbFile)) { + $this->entries = json_decode(file_get_contents($this->dbFile), true); + } + } + + public function handleFormSubmission() { + if (isset($_POST['guestbook'], $_POST['guest-name'], $_POST['guest-message'])) { + $this->addEntry($_POST['guest-name'], $_POST['guest-message']); + $this->saveEntries(); + } + } + + private function addEntry($name, $message) { + $this->entries[] = [ + 'name' => $name, + 'message' => $message, + 'date' => date('Y-m-d H:i:s') + ]; + } + + private function saveEntries() { + file_put_contents($this->dbFile, json_encode($this->entries)); + } + + public function displayForm() { + return ' +
+ + + + + + +
'; + } + + public function displayEntries() { + $output = '
'; + foreach ($this->entries as $entry) { + $output .= " +
+

{$entry['name']}

+

{$entry['message']}

+ {$entry['date']} +
"; + } + $output .= '
'; + return $output; + } +} + +class ContactManager { + public function displayForm() { + return ' +
+ + + + + + + + +
'; + } + + public function handleSubmission($name, $email, $message) { + $feedback = [ + 'name' => $name, + 'email' => $email, + 'message' => $message, + 'date' => date('Y-m-d H:i:s') + ]; + $feedbacks = json_decode(file_get_contents('feedbacks.json') ?: '[]', true); + $feedbacks[] = $feedback; + file_put_contents('feedbacks.json', json_encode($feedbacks)); + } +} + +class AdminManager { + public function isAdmin() { + return isset($_SESSION['admin']) && $_SESSION['admin'] === true; + } + + public function handleLogin($username, $password) { + if ($username === 'admin' && $password === 'sonne4000') { + $_SESSION['admin'] = true; + return true; + } + return false; + } + + public function displayLoginForm() { + return ' +
+ + + + + + +
'; + } + + public function displayAdminContent() { + $feedbacks = json_decode(file_get_contents('feedbacks.json') ?: '[]', true); + $output = '

Admin-Bereich

'; + foreach ($feedbacks as $feedback) { + $output .= "
"; + $output .= "

{$feedback['name']} ({$feedback['email']})

"; + $output .= "

{$feedback['message']}

"; + $output .= "{$feedback['date']}"; + $output .= "
"; + } + $output .= '
'; + + $output .= ' +

Social Media Links verwalten

+
+ + + + +
'; + + return $output; + } + + public function handleSocialMediaUpdate($platform, $url) { + $socialLinks = json_decode(file_get_contents('social_links.json') ?: '{}', true); + $socialLinks[$platform] = $url; + file_put_contents('social_links.json', json_encode($socialLinks)); + } +} + +$webcamManager = new WebcamManager(); +$guestbookManager = new GuestbookManager(); +$contactManager = new ContactManager(); +$adminManager = new AdminManager(); + +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + if (isset($_POST['guestbook'])) { + $guestbookManager->handleFormSubmission(); + } elseif (isset($_POST['contact'])) { + $contactManager->handleSubmission($_POST['name'], $_POST['email'], $_POST['message']); + } elseif (isset($_POST['admin-login'])) { + $adminManager->handleLogin($_POST['username'], $_POST['password']); + } elseif (isset($_POST['update-social-media'])) { + $adminManager->handleSocialMediaUpdate($_POST['social-platform'], $_POST['social-url']); + } +} +?> + + + + @@ -6,371 +211,246 @@ Aurora Wetter Lifecam - Einzigartige Live-Webcam und Wetter -
-
-
-
-
-

Willkommen bei Aurora Wetter Lifecam

-

Erleben Sie faszinierende Ausblicke der Züricher Region - in Echtzeit!

- Zu der Webcam -
-
+

Unsere Webcam

-
-
- -

Zürichsee & Berge

-
-
+ displayWebcam(); ?>
-
+ + + + + +
+
+

QR-Code für diese Seite

+
+
+
+ + + + + + + + + + +
-

Über unser Projekt

-
-
-

Aurora Wetter Lifecam ist ein Herzensprojekt von Wetterbegeisterten. Wir möchten Ihnen die Schönheit der Natur und Faszination des Wetters näher bringen.

-

Dazu betreiben wir seit 2010 rund um die Uhr hochauflösende Webcams. Besonders stolz sind wir auf einzigartige Einblicke, wie z.B. die Trainingsflüge der Patrouille Suisse jeden Montagmorgen.

-
-
+

Gästebuch

+ displayForm(); + echo $guestbookManager->displayEntries(); + ?>

Kontakt

-

Haben Sie Fragen, Anregungen oder möchten uns unterstützen? Wir freuen uns auf Ihre Nachricht!

-
- - - - - - - - - - -
+ displayForm(); ?>
+ + + isAdmin()): ?> +
+
+

Admin-Bereich

+ displayAdminContent(); ?> +
+
+

Admin Login

-
- - - - - - - -
+ displayLoginForm(); ?>
+ -
+
-

Admin-Bereich: Benutzernachrichten

-
+

Folgen Sie uns

+
+ + + + + + + +
+ + + - + +