PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, ] ); $stmtLoc = $pdo->prepare( 'SELECT id, name, latitude, longitude, elevation, timezone FROM app_user_locations WHERE user_id = ? AND is_default = 1 LIMIT 1' ); $stmtLoc->execute([(int) $_SESSION['user_id']]); $currentLocation = $stmtLoc->fetch() ?: null; } catch (Throwable $e) { $currentLocation = null; } } $pageLocation = null; if (!empty($currentLocation) && is_array($currentLocation)) { $pageLocation = [ 'name' => (string) ($currentLocation['name'] ?? ''), 'latitude' => isset($currentLocation['latitude']) ? (float) $currentLocation['latitude'] : null, 'longitude' => isset($currentLocation['longitude']) ? (float) $currentLocation['longitude'] : null, 'elevation' => isset($currentLocation['elevation']) && $currentLocation['elevation'] !== null ? (float) $currentLocation['elevation'] : 0.0, 'timezone' => (string) ($currentLocation['timezone'] ?? 'Europe/Berlin'), ]; } if ($_SERVER['REQUEST_METHOD'] === 'POST' && (string) ($_POST['ajax'] ?? '') === '1') { header('Content-Type: application/json; charset=utf-8'); if ($pageLocation === null || $pageLocation['latitude'] === null || $pageLocation['longitude'] === null) { echo json_encode([ 'ok' => false, 'error' => 'Kein gueltiger Standard-Standort verfuegbar.', ], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); exit; } $dateText = trim((string) ($_POST['date'] ?? '')); $date = DateTimeImmutable::createFromFormat('Y-m-d', $dateText); $dateErrors = DateTimeImmutable::getLastErrors(); if ($dateErrors === false) { $dateErrors = ['warning_count' => 0, 'error_count' => 0]; } if ($date === false || ($dateErrors['warning_count'] ?? 0) > 0 || ($dateErrors['error_count'] ?? 0) > 0) { echo json_encode([ 'ok' => false, 'error' => 'Datum muss im Format YYYY-MM-DD uebergeben werden.', ], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); exit; } $pythonResult = runPythonApi('planet_visibility_chart', [ (string) $pageLocation['latitude'], (string) $pageLocation['longitude'], (string) $pageLocation['elevation'], $dateText, (string) $pageLocation['timezone'], ]); if (!$pythonResult['ok']) { echo json_encode([ 'ok' => false, 'error' => (string) ($pythonResult['error'] ?? 'Python-Fehler'), ], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); exit; } echo json_encode($pythonResult['data'], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); exit; } ?>

Kein Standard-Standort gesetzt

Diese Seite verwendet den im Header geladenen Standard-Standort aus der Datenbank. Bitte waehle in den Einstellungen einen Standard-Standort aus.

Sichtbarkeit der Planeten und des Mondes über 24 Stunden für deinen Standard-Standort aus der Datenbank.

Datum:
Tag / Nacht
Über Horizont
Beste Sichtbarkeit
Aktuelle Uhrzeit
Berechne Positionen...