$row */ function buildStarLabel(array $row): string { $proper = trim((string)($row['proper'] ?? '')); if ($proper !== '') { return $proper; } $bf = trim((string)($row['bf'] ?? '')); if ($bf !== '') { return $bf; } $hip = isset($row['hip']) ? (int)$row['hip'] : 0; if ($hip > 0) { return 'HIP ' . $hip; } return 'Unbenannter Stern'; } $brightStars = []; $detailMapStars = []; $constellationLines = []; $dayMeta = null; $starCatalogLimit = 6.0; $detailMapCatalogLimit = 8.0; try { $config = require __DIR__ . '/../config/database.php'; $dsn = sprintf( 'mysql:host=%s;dbname=%s;charset=%s', $config['host'], $config['dbname'], $config['charset'] ?? 'utf8mb4' ); $pdo = new PDO( $dsn, $config['user'], $config['pass'], [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, ] ); if ($loggedIn && isset($_SESSION['user_id'])) { $stmtLocation = $pdo->prepare( 'SELECT id, name, latitude, longitude, elevation, timezone FROM app_user_locations WHERE user_id = ? AND is_default = 1 LIMIT 1' ); $stmtLocation->execute([(int)$_SESSION['user_id']]); $defaultLocation = $stmtLocation->fetch() ?: null; } } catch (Throwable $exception) { $dataLoadError = $exception->getMessage(); } require __DIR__ . '/header.php'; $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 ($dataLoadError === null && $pdo instanceof PDO && $pageLocation !== null && $pageLocation['latitude'] !== null && $pageLocation['longitude'] !== null) { $tz = new DateTimeZone($pageLocation['timezone']); $todayLocal = new DateTimeImmutable('now', $tz); $dayStartLocal = $todayLocal->setTime(0, 0, 0); $dayEndLocal = $dayStartLocal->modify('+1 day'); $dayMeta = [ 'localDate' => $dayStartLocal->format('Y-m-d'), 'localDateLabel' => $dayStartLocal->format('d.m.Y'), 'dayStartUtc' => $dayStartLocal->setTimezone(new DateTimeZone('UTC'))->format(DateTimeInterface::ATOM), 'dayEndUtc' => $dayEndLocal->setTimezone(new DateTimeZone('UTC'))->format(DateTimeInterface::ATOM), ]; try { $stmt = $pdo->query( "SELECT `hip`, `proper`, `bf`, `con`, `mag`, `ra`, `dec`, `dist` FROM `star_hipparcos` WHERE `mag` IS NOT NULL AND `ra` IS NOT NULL AND `dec` IS NOT NULL AND `mag` <= 6.0 ORDER BY `mag` ASC, `proper` ASC, `bf` ASC, `hip` ASC" ); foreach ($stmt->fetchAll() as $row) { $brightStars[] = [ 'hip' => isset($row['hip']) ? (int)$row['hip'] : 0, 'label' => buildStarLabel($row), 'constellation' => trim((string)($row['con'] ?? '')), 'mag' => isset($row['mag']) ? (float)$row['mag'] : null, 'ra' => isset($row['ra']) ? (float)$row['ra'] : null, 'dec' => isset($row['dec']) ? (float)$row['dec'] : null, 'distLy' => isset($row['dist']) && $row['dist'] !== null && (float)$row['dist'] > 0.0 ? (float)$row['dist'] * 3.26156 : 1000.0, ]; } $stmtDetailMap = $pdo->query( "SELECT `hip`, `proper`, `bf`, `con`, `mag`, `ra`, `dec`, `dist` FROM `star_hipparcos` WHERE `mag` IS NOT NULL AND `ra` IS NOT NULL AND `dec` IS NOT NULL AND `mag` <= 8.0 ORDER BY `mag` ASC, `proper` ASC, `bf` ASC, `hip` ASC" ); foreach ($stmtDetailMap->fetchAll() as $row) { $detailMapStars[] = [ 'hip' => isset($row['hip']) ? (int)$row['hip'] : 0, 'label' => buildStarLabel($row), 'constellation' => trim((string)($row['con'] ?? '')), 'mag' => isset($row['mag']) ? (float)$row['mag'] : null, 'ra' => isset($row['ra']) ? (float)$row['ra'] : null, 'dec' => isset($row['dec']) ? (float)$row['dec'] : null, 'distLy' => isset($row['dist']) && $row['dist'] !== null && (float)$row['dist'] > 0.0 ? (float)$row['dist'] * 3.26156 : 1000.0, ]; } $stmtLines = $pdo->query( "SELECT cl.`id` AS line_id, clp.`point_index`, sh.`ra` AS ra_hours, sh.`dec` AS dec_deg FROM `constellation_lines` cl INNER JOIN `constellation_line_points` clp ON clp.`line_id` = cl.`id` INNER JOIN `star_hipparcos` sh ON sh.`hip` = clp.`hip_number` WHERE sh.`ra` IS NOT NULL AND sh.`dec` IS NOT NULL ORDER BY cl.`id`, clp.`point_index`" ); foreach ($stmtLines->fetchAll() as $row) { $lineId = (int)$row['line_id']; $constellationLines[$lineId][] = [ 'ra' => isset($row['ra_hours']) ? (float)$row['ra_hours'] : null, 'dec' => isset($row['dec_deg']) ? (float)$row['dec_deg'] : null, ]; } } catch (Throwable $exception) { $dataLoadError = $exception->getMessage(); $brightStars = []; $detailMapStars = []; $constellationLines = []; } } ?>
Fuer die Berechnung wird der Standard-Standort aus der Datenbank verwendet. Bitte waehle in den Einstellungen einen Standard-Standort aus.
Die Hipparcos-Sterndaten oder die Datenbankverbindung konnten nicht geladen werden. Dadurch ist die heutige Bedeckungsberechnung momentan nicht moeglich.
Technischer Hinweis: = htmlspecialchars($dataLoadError, ENT_QUOTES, 'UTF-8') ?>
| Stern | mag | Eintritt | Maximum | Austritt | Dauer | Sichtbarkeit | Randabstand | Mondhoehe |
|---|---|---|---|---|---|---|---|---|
| Berechnung laeuft... | ||||||||