Freitag, 10 April 2026

Diese Woche am beliebtesten

Vertiefendes Material

Astro Radar Script

Bieten Sie Ihren Besuchern ein echtes interaktives Highlight! Unser Astro Radar 2026 liefert weit mehr als statische Infos, indem es Echtzeit Daten der NOAA mit präzisen Standort Analysen über eine Geocoding API kombiniert.

Ihre Vorteile als Hoster:

  • Live Weltraumwetter: Ein integrierter KP Index Tracker zeigt die tatsächliche Wahrscheinlichkeit für Polarlichter in Deutschland in Echtzeit an, Schluss mit dem Raten!
  • Präzision für 2026: Das Script ist speziell optimiert auf die große Sonnenfinsternis am 12. August 2026
  • Echter Besucher Magnet: Steigern Sie Traffic und Verweildauer! Das Tool liefert Nutzern individuelle astronomische Daten (Sonnenuntergang, Dämmerung, Sichtbarkeit) basierend auf ihrem genauen Wohnort.
  • SEO & Performance Boost: Profitieren Sie von schlankem Code ohne Ballast für Top Rankings in Suchmaschinen.

Dieses leistungsstarke Tool ist ideal für Nischenseiten, Nachrichtenportale oder Hobby Astronomen, die ihren Traffic durch hochwertige interaktive Mehrwerte steigern möchten. Laden Sie das Script jetzt herunter und starten Sie Ihr eigenes professionelles astronomisches Informationszentrum direkt auf Ihrer Domain!

<?php
$cssPath = 'css/astro.css';
// --- SETUP BLOCK: DIESER TEIL LÖSCHT SICH SELBST ---
if (!file_exists($cssPath)) {
    if (!is_dir('css')) mkdir('css', 0755, true);
    $css = ":root { --space: #020205; --aurora: #00ffcc; --gold: #ffcc33; --danger: #ff4d4d; --glass: rgba(255, 255, 255, 0.03); --text: #e0e0e0; }\n";
    $css .= "body { background: var(--space); color: var(--text); font-family: 'Inter', sans-serif; margin: 0; background-image: radial-gradient(circle at 50% 50%, #0d1117 0%, #020205 100%); line-height: 1.6; }\n";
    $css .= ".container { max-width: 1100px; margin: 0 auto; padding: 40px 20px; }\n";
    $css .= "header { text-align: center; margin-bottom: 50px; }\n";
    $css .= "h1 { font-size: 3rem; margin: 0; background: linear-gradient(45deg, #fff, var(--aurora)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }\n";
    $css .= "h1 span { color: var(--aurora); -webkit-text-fill-color: var(--aurora); }\n";
    $css .= "header p { opacity: 0.7; margin-top: 10px; }\n";
    $css .= ".glass-card { background: var(--glass); backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 25px; padding: 35px; margin-bottom: 25px; transition: 0.3s; }\n";
    $css .= ".grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }\n";
    $css .= ".card-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; opacity: 0.8; }\n";
    $css .= ".card-title { margin: 10px 0; font-size: 1.8rem; }\n";
    $css .= ".kp-badge { display: inline-block; padding: 8px 16px; border-radius: 12px; font-weight: 800; margin-top: 10px; }\n";
    $css .= ".status-safe { border-top: 3px solid var(--aurora); }\n";
    $css .= ".status-storm { border-top: 3px solid var(--danger); }\n";
    $css .= ".status-event { border-top: 3px solid var(--gold); }\n";
    $css .= ".badge-safe { background: rgba(0, 255, 204, 0.1); color: var(--aurora); }\n";
    $css .= ".badge-storm { background: rgba(255, 77, 77, 0.1); color: var(--danger); }\n";
    $css .= ".btn-primary { background: linear-gradient(135deg, var(--aurora), #00a3ff); color: #000; border: none; padding: 18px; border-radius: 15px; font-weight: 800; cursor: pointer; width: 100%; transition: 0.3s; margin-top: 10px; }\n";
    $css .= ".btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(0, 255, 204, 0.2); }\n";
    $css .= "input { width: 100%; padding: 18px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 12px; color: #fff; margin-bottom: 15px; box-sizing: border-box; font-size: 1.1rem; }\n";
    $css .= ".analysis-box { margin-top: 25px; padding: 25px; background: rgba(255, 255, 255, 0.04); border-radius: 20px; border-left: 4px solid var(--aurora); }\n";
    $css .= "footer { text-align: center; padding: 60px; opacity: 0.5; }\n";
    $css .= "footer a { color: var(--aurora); text-decoration: none; font-weight: 700; }";
    file_put_contents($cssPath, $css);

    $fileContent = file_get_contents(__FILE__);
    $cleanContent = preg_replace('/(\/\/ --- SETUP BLOCK).*?(\/\/ --- END SETUP BLOCK ---)/s', '// Setup erfolgreich.', $fileContent);
    file_put_contents(__FILE__, $cleanContent);
}
// --- END SETUP BLOCK ---
function getLiveKP() {
    $url = "https://services.swpc.noaa.gov/products/noaa-estimated-planetary-k-index-1-minute.json";
    $ctx = stream_context_create(["http" => ["timeout" => 2]]);
    $data = @json_decode(file_get_contents($url, false, $ctx), true);
    if (!$data) return 2.0; 
    $latest = end($data);
    return (float)$latest[1];
}
$current_kp = getLiveKP();
$is_storm = ($current_kp >= 5);
$kp_class = $is_storm ? 'status-storm' : 'status-safe';
$badge_class = $is_storm ? 'badge-danger' : 'badge-safe';
$kp_text = $is_storm ? 'Warnung: Geomagnetischer Sturm!' : 'Ruhiges Magnetfeld';

$loc = null;
if (!empty($_POST['city'])) {
    $city = urlencode($_POST['city']);
    $geo = @json_decode(file_get_contents("https://nominatim.openstreetmap.org/search?q=$city&format=json&limit=1", false, stream_context_create(["http" => ["header" => "User-Agent: AstroBot/1.0"]])), true);
    if ($geo) {
        $lat = $geo[0]['lat']; $lon = $geo[0]['lon'];
        $astro = @json_decode(file_get_contents("https://api.sunrise-sunset.org/json?lat=$lat&lng=$lon&formatted=0"), true);
        if ($astro) {
            $loc = [
                'name' => explode(',', $geo[0]['display_name'])[0],
                'sunset' => date('H:i', strtotime($astro['results']['sunset'])),
                'kp' => $current_kp
            ];
        }
    }
}
?>
<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Astro Radar 2026 | Live KP Index & Finsternis</title>
    <link rel="stylesheet" href="<?= $cssPath ?>">
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700;900&display=swap" rel="stylesheet">
</head>
<body>
<div class="container">
    <header>
        <h1>Astro<span>Radar</span> Live</h1>
        <p>Echtzeit-Daten für Astronomie & Weltraumwetter</p>
    </header>
    <div class="grid">
        <section class="glass-card <?= $kp_class ?>">
            <div class="card-label">Live Weltraumwetter</div>
            <h2 class="card-title">KP-Index: <?= number_format($current_kp, 1) ?></h2>
            <div class="kp-badge <?= $is_storm ? 'badge-storm' : 'badge-safe' ?>">
                <?= $kp_text ?>
            </div>
            <p><?= ($current_kp >= 4) ? "Gute Chancen für Polarlichter in Nordeuropa!" : "Aktuell ruhige Bedingungen für Beobachtungen." ?></p>
        </section>
        <section class="glass-card status-event">
            <div class="card-label">Nächstes Großereignis</div>
            <h2 class="card-title">Sonnenfinsternis</h2>
            <p><strong>12. August 2026</strong></p>
            <p>Erste totale Finsternis über Europa seit Jahrzehnten. Optimale Sichtbarkeit im Westen.</p>
        </section>
    </div>
    <section class="glass-card">
        <h2>Standort-Check</h2>
        <form method="POST">
            <input type="text" name="city" placeholder="Stadt eingeben (z.B. Hamburg)..." required value="<?= htmlspecialchars($_POST['city'] ?? '') ?>">
            <button type="submit" class="btn-primary">Daten abrufen</button>
        </form>
        <?php if ($loc): ?>
        <div class="analysis-box">
            <h3>Analyse für <?= $loc['name'] ?></h3>
            <p>🌇 Sonnenuntergang heute: <strong><?= $loc['sunset'] ?> Uhr</strong></p>
            <p>✨ Polarlicht-Chance: <strong><?= ($loc['kp'] > 5) ? 'HOCH (Kamera bereit halten!)' : 'Sehr gering' ?></strong></p>
            <p>🔭 Event-Status 2026: <strong>Sichtbarkeit Sonnenfinsternis exzellent</strong></p>
        </div>
        <?php endif; ?>
    </section>
    <footer>
        <p>© 2026 · <a href="https://www.dreamcodes.net" target="_blank">Dreamcodes</a></p>
    </footer>
</div>
</body>
</html>
Dreamcodes Redaktion
Dreamcodes Redaktion
Qualität als Standard. Verantwortung als Prinzip. Jede Ressource auf Dreamcodes basiert auf geprüften Best Practices und fundierter Praxiserfahrung. Unser Anspruch ist ein belastbares Fundament statt experimenteller Lösungen. Die Integration und Absicherung der Inhalte liegt in Ihrem Ermessen. Wir liefern die fachliche Basis, die Verantwortung für den produktiven Einsatz verbleibt bei Ihnen.
Vorheriges Tutorial
Nächstes Tutorial

Vielleicht einen Blick WERT?