diff --git a/index.php b/index.php
new file mode 100644
index 0000000..66eea26
--- /dev/null
+++ b/index.php
@@ -0,0 +1,2372 @@
+ $latestTime) {
+ $latestTime = $mtime;
+ $latestVideo = $video;
+ }
+ }
+
+ if ($latestVideo) {
+ header('Content-Description: File Transfer');
+ header('Content-Type: application/octet-stream');
+ header('Content-Disposition: attachment; filename="'.basename($latestVideo).'"');
+ header('Expires: 0');
+ header('Cache-Control: must-revalidate');
+ header('Pragma: public');
+ header('Content-Length: ' . filesize($latestVideo));
+ readfile($latestVideo);
+ exit;
+ } else {
+ echo "Kein Video zum Herunterladen gefunden.";
+ exit;
+ }
+}
+
+
+
+
+// Funktion zur sicheren Umleitung
+function safeRedirect($url) {
+ if (!headers_sent()) {
+ header("HTTP/1.1 301 Moved Permanently");
+ header("Location: " . $url);
+ } else {
+ echo '';
+ }
+ exit();
+}
+
+// Hauptlogik
+$oldDomains = [
+ 'www.aurora-wetter-lifecam.ch',
+ 'www.aurora-wetter-livecam.ch'
+];
+$newDomain = 'www.aurora-weather-livecam.com';
+
+if (in_array($_SERVER['HTTP_HOST'], $oldDomains)) {
+ $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http';
+ $newUrl = $protocol . '://' . $newDomain . $_SERVER['REQUEST_URI'];
+
+ // Logging für Debugging
+ error_log("Umleitung von {$_SERVER['HTTP_HOST']} nach $newUrl");
+
+ if (!headers_sent()) {
+ header("HTTP/1.1 301 Moved Permanently");
+ header("Location: " . $newUrl);
+ } else {
+ echo '';
+ }
+ exit();
+}
+
+
+
+
+
+session_start();
+error_reporting(E_ALL);
+ini_set('display_errors', 1);
+$imageDir = "./image"; // Angepasst an das Ausgabeverzeichnis des Bash-Skripts
+$imageFiles = glob("$imageDir/screenshot_*.jpg");
+rsort($imageFiles); // Sortiert die Dateien in umgekehrter Reihenfolge (neueste zuerst)
+$imageFilesJson = json_encode($imageFiles);
+
+class WebcamManager {
+
+ private $videoSrc = 'test_video.m3u8';
+ private $logoPath = 'logo.png';
+
+ public function displayWebcam() {
+ return ' ';
+
+
+ }
+
+
+ public function captureSnapshot() {
+
+ $outputFile = 'snapshot_' . date('YmdHis') . '.jpg';
+ $command = "ffmpeg -i {$this->videoSrc} -i {$this->logoPath} -filter_complex 'overlay=main_w-overlay_w-10:10' -vframes 1 -q:v 2 {$outputFile}";
+
+
+ exec($command, $output, $returnVar);
+
+ if ($returnVar !== 0) {
+ return "Fehler beim Erstellen des Snapshots.";
+ }
+
+ // Kopieren des Snapshots in den Uploads-Ordner
+ $uploadDir = "uploads/";
+ if (!file_exists($uploadDir)) {
+ mkdir($uploadDir, 0777, true);
+
+ }
+
+ $uploadFile = $uploadDir . $outputFile;
+ if (copy($outputFile, $uploadFile)) {
+
+ } else {
+
+ }
+
+
+
+ header('Content-Type: application/octet-stream');
+ header('Content-Disposition: attachment; filename="' . $outputFile . '"');
+ readfile($outputFile);
+ unlink($outputFile);
+ exit;
+ }
+ public function getImageFiles() {
+ $imageFiles = glob("image/*.{jpg,jpeg,png,gif}", GLOB_BRACE);
+ return json_encode($imageFiles);
+ }
+
+ public function captureVideoSequence($duration = 10) {
+ $outputFile = 'sequence_' . date('YmdHis') . '.mp4';
+ $command = "ffmpeg -i {$this->videoSrc} -i {$this->logoPath} -filter_complex 'overlay=10:10' -t {$duration} -c:v libx264 -preset fast -crf 23 {$outputFile}";
+
+ exec($command, $output, $returnVar);
+
+ if ($returnVar !== 0) {
+ return "Fehler beim Erstellen der Video-Sequenz.";
+ }
+
+ // Kopieren des Videoclips in den Uploads-Ordner
+ $uploadDir = "uploads/";
+ if (!file_exists($uploadDir)) {
+ mkdir($uploadDir, 0777, true);
+ echo "Uploads-Ordner erstellt. ";
+ }
+
+ $uploadFile = $uploadDir . $outputFile;
+ if (copy($outputFile, $uploadFile)) {
+
+ } else {
+ echo "Fehler beim Kopieren des Videoclips in den Uploads-Ordner. ";
+ }
+
+
+
+ header('Content-Type: video/mp4');
+ header('Content-Disposition: attachment; filename="' . $outputFile . '"');
+ readfile($outputFile);
+ unlink($outputFile);
+ exit;
+ }
+
+ 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')
+ ];
+ }
+
+ public function deleteEntry($index) {
+ if (isset($this->entries[$index])) {
+ unset($this->entries[$index]);
+ $this->entries = array_values($this->entries); // Re-indizieren des Arrays
+ $this->saveEntries();
+ return true;
+ }
+ return false;
+ }
+
+
+
+ private function saveEntries() {
+ file_put_contents($this->dbFile, json_encode($this->entries));
+ }
+
+ public function displayForm() {
+ return '
+
';
+ foreach ($this->entries as $index => $entry) {
+ $output .= "
+
+
{$entry['name']}
+
{$entry['message']}
+
{$entry['date']}";
+ if ($isAdmin) {
+ $output .= "
";
+ }
+
+ }
+ $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) {
+ echo "Login-Versuch: Username = $username, Passwort = $password"; // Debugging
+ if ($username === 'admin' && $password === 'sonne4000') {
+ $_SESSION['admin'] = true;
+ return true;
+ }
+ return false;
+ }
+
+ public function handleImageUpload($file) {
+ if (!$this->isAdmin()) {
+ return false; // Nur Admins dürfen Bilder hochladen
+ }
+
+ if (!isset($file['tmp_name']) || empty($file['tmp_name'])) {
+ echo "Keine Datei hochgeladen.";
+ return false;
+ }
+
+ $target_dir = "uploads/";
+ if (!file_exists($target_dir)) {
+ mkdir($target_dir, 0777, true);
+ }
+
+ $target_file = $target_dir . basename($file["name"]);
+ $uploadOk = 1;
+ $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
+
+
+ $check = @getimagesize($file["tmp_name"]);
+ if($check === false) {
+ echo "Die Datei ist kein Bild.";
+ return false;
+ }
+
+
+ if ($file["size"] > 5000000) { // 5MB Limit
+ echo "Die Datei ist zu groß.";
+ return false;
+ }
+
+ // Erlauben Sie nur bestimmte Dateiformate
+ if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
+ && $imageFileType != "gif" ) {
+ echo "Nur JPG, JPEG, PNG & GIF Dateien sind erlaubt.";
+ return false;
+ }
+
+ // Wenn alles in Ordnung ist, versuchen Sie, die Datei hochzuladen
+ if (move_uploaded_file($file["tmp_name"], $target_file)) {
+ echo "Die Datei ". basename( $file["name"]). " wurde hochgeladen.";
+ return true;
+ } else {
+ echo "Es gab einen Fehler beim Hochladen der Datei.";
+ return false;
+ }
+ }
+
+
+ public function displayLoginForm() {
+ return '
+
+
+ Benutzername:
+
+ Passwort:
+
+ Einloggen
+ ';
+ }
+
+ 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
+
+
+
+ Facebook
+ Instagram
+ TikTok
+
+
+ Aktualisieren
+ ';
+ $output .= '
+
Bild hochladen
+
+
+
+ ';
+ return $output;
+ }
+
+ public function displayGalleryImages() {
+ $output = '
';
+ $files = glob("uploads/*.*");
+ foreach($files as $file) {
+ $filename = basename($file);
+ $output .= '
';
+ }
+ $output .= '
';
+ 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));
+ }
+}
+
+
+
+
+
+
+// Neue VideoArchiveManager Klasse
+
+
+class VideoArchiveManager {
+ private $videoDir;
+ private $monthNames;
+
+ public function __construct($videoDir = './image/') {
+ $this->videoDir = $videoDir;
+ $this->monthNames = [
+ '01' => 'Januar',
+ '02' => 'Februar',
+ '03' => 'März',
+ '04' => 'April',
+ '05' => 'Mai',
+ '06' => 'Juni',
+ '07' => 'Juli',
+ '08' => 'August',
+ '09' => 'September',
+ '10' => 'Oktober',
+ '11' => 'November',
+ '12' => 'Dezember'
+ ];
+ }
+
+ public function getVideosGroupedByDate() {
+ $videos = [];
+
+ foreach (glob($this->videoDir . 'daily_video_*.mp4') as $video) {
+ // Dateinamenformat: daily_video_YYYYMMDD_HHMMSS.mp4
+ if (preg_match('/daily_video_(\d{8})_\d{6}\.mp4/', basename($video), $matches)) {
+ $dateStr = $matches[1]; // YYYYMMDD
+ $year = substr($dateStr, 0, 4);
+ $month = substr($dateStr, 4, 2);
+ $day = substr($dateStr, 6, 2);
+
+ // Gruppiere nach Jahr und Monat
+ $videos[$year][$month][] = [
+ 'path' => $video,
+ 'filename' => basename($video),
+ 'day' => $day,
+ 'filesize' => filesize($video),
+ 'modified' => filemtime($video)
+ ];
+ }
+ }
+
+ // Nach Tag sortieren
+ foreach ($videos as $year => $months) {
+ foreach ($months as $month => $days) {
+ usort($videos[$year][$month], function($a, $b) {
+ return $b['day'] - $a['day']; // Absteigend sortieren (neueste zuerst)
+ });
+ }
+ }
+
+ return $videos;
+ }
+
+ public function getAvailableYearsAndMonths() {
+ $videos = $this->getVideosGroupedByDate();
+ $result = [];
+
+ foreach ($videos as $year => $months) {
+ $result[$year] = array_keys($months);
+ }
+
+ return $result;
+ }
+
+ public function getVideosForYearAndMonth($year, $month) {
+ $videos = $this->getVideosGroupedByDate();
+ return isset($videos[$year][$month]) ? $videos[$year][$month] : [];
+ }
+
+ public function displayCalendarInterface() {
+ $yearsAndMonths = $this->getAvailableYearsAndMonths();
+
+ $output = '
';
+ $output .= '
Video-Archiv ';
+
+ if (empty($yearsAndMonths)) {
+ $output .= '
Keine Videos verfügbar.
';
+ } else {
+ $output .= '
';
+ $output .= '
';
+
+ // Jahr-Auswahl
+ $output .= 'Jahr: ';
+ $output .= '';
+
+ foreach ($yearsAndMonths as $year => $months) {
+ $selected = (isset($_GET['calendar_year']) && $_GET['calendar_year'] == $year) ? 'selected' : '';
+ $output .= "$year ";
+ }
+
+ $output .= ' ';
+
+ // Monats-Auswahl
+ $output .= 'Monat: ';
+ $output .= '';
+
+ // Wenn ein Jahr ausgewählt wurde, zeige die verfügbaren Monate
+ if (isset($_GET['calendar_year']) && isset($yearsAndMonths[$_GET['calendar_year']])) {
+ foreach ($yearsAndMonths[$_GET['calendar_year']] as $month) {
+ $selected = (isset($_GET['calendar_month']) && $_GET['calendar_month'] == $month) ? 'selected' : '';
+ $output .= "{$this->monthNames[$month]} ";
+ }
+ }
+
+ $output .= ' ';
+ $output .= 'Anzeigen ';
+ $output .= ' ';
+ $output .= '';
+
+ // Wenn Jahr und Monat ausgewählt wurden, zeige die Videos
+ if (isset($_GET['calendar_year']) && isset($_GET['calendar_month'])) {
+ $year = $_GET['calendar_year'];
+ $month = $_GET['calendar_month'];
+ $videos = $this->getVideosForYearAndMonth($year, $month);
+
+ if (!empty($videos)) {
+ $output .= '
';
+ $output .= "
Videos für {$this->monthNames[$month]} $year ";
+ $output .= '
';
+ $output .= '
';
+ } else {
+ $output .= "
Keine Videos für {$this->monthNames[$month]} $year gefunden.
";
+ }
+ }
+ }
+
+ $output .= '
';
+ return $output;
+ }
+
+ public function handleSpecificVideoDownload() {
+ if (isset($_GET['download_specific_video']) && isset($_GET['token'])) {
+ $videoPath = $_GET['download_specific_video'];
+ $token = $_GET['token'];
+
+ // Token-Validierung
+ $expectedToken = hash_hmac('sha256', $videoPath, session_id());
+ if (!hash_equals($expectedToken, $token)) {
+ echo "Ungültiger Token. Zugriff verweigert.";
+ exit;
+ }
+
+ // Sicherheitsüberprüfung: Stelle sicher, dass das Video im erlaubten Verzeichnis liegt
+ $videoDir = realpath($this->videoDir);
+ $requestedPath = realpath($videoPath);
+
+ if ($requestedPath && strpos($requestedPath, $videoDir) === 0 && file_exists($requestedPath)) {
+ // Nur MP4-Dateien erlauben
+ $extension = pathinfo($requestedPath, PATHINFO_EXTENSION);
+ if (strtolower($extension) !== 'mp4') {
+ echo "Nur MP4-Dateien können heruntergeladen werden.";
+ exit;
+ }
+
+ header('Content-Description: File Transfer');
+ header('Content-Type: video/mp4');
+ header('Content-Disposition: attachment; filename="'.basename($requestedPath).'"');
+ header('Expires: 0');
+ header('Cache-Control: must-revalidate');
+ header('Pragma: public');
+ header('Content-Length: ' . filesize($requestedPath));
+ readfile($requestedPath);
+ exit;
+ } else {
+ echo "Datei nicht gefunden oder ungültiger Dateipfad.";
+ exit;
+ }
+ }
+ }
+}
+
+
+
+
+
+
+
+$webcamManager = new WebcamManager();
+$imageFilesJson = $webcamManager->getImageFiles();
+$guestbookManager = new GuestbookManager();
+$contactManager = new ContactManager();
+$adminManager = new AdminManager();
+
+// Nach den anderen Manager-Instanzen hinzufügen
+$videoArchiveManager = new VideoArchiveManager('./image/');
+
+// Video-Download-Handler nach dem existierenden Download-Handler hinzufügen
+$videoArchiveManager->handleSpecificVideoDownload();
+
+
+if (isset($_GET['action'])) {
+ switch ($_GET['action']) {
+ case 'snapshot':
+ $webcamManager->captureSnapshot();
+
+ break;
+ case 'sequence':
+ $webcamManager->captureVideoSequence();
+
+ 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') {
+ 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']);
+
+
+ } elseif (isset($_FILES["fileToUpload"]) && $adminManager->isAdmin()) {
+ $adminManager->handleImageUpload($_FILES["fileToUpload"]);
+}}
+?>
+
+
+
+
+
+
+
+
+
+
Aurora Livecam - Einzigartige Live-Webcam und Wetter>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Willkommen bei Aurora Wetter Livecam
+
+
+
+
+
+
+ Erleben Sie faszinierende Ausblicke der Züricher Region - in Echtzeit!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ displayWebcam(); ?>
+
+
+
+
+
+
+
Videoarchiv
+
+ Durchsuchen und Herunterladen von Videos nach Monat und Jahr.
+
+ displayCalendarInterface(); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+