106 lines
2.9 KiB
PHP
106 lines
2.9 KiB
PHP
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml" lang="de-DE">
|
||
<head profile="http://gmpg.org/xfn/11">
|
||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||
<?php
|
||
//aktuelles Datum in Jahre umrechnen
|
||
$year = ((((((date("s") / 60)+ date("i")) / 60)+date("G")) / 24) + date("z") - 1) / (365 + (date("L"))) + date("Y");
|
||
//
|
||
$rads = 3.14159265359/180;
|
||
$phase=0.5;
|
||
|
||
//Anzahl der Mondphasen seit 2000
|
||
$k = floor(($year-2000)*12.36853087)+$phase;
|
||
// Mittlerer JDE Wert des Ereignisses
|
||
$JDE = 2451550.09766+29.530588861*$k;
|
||
// Relevante Winkelwerte in [Radiant]
|
||
$M = (2.5534+29.10535670*$k)*$rads;
|
||
$Ms = (201.5643+385.81693528*$k)*$rads;
|
||
$F = (160.7108+390.67050284*$k)*$rads;
|
||
//
|
||
// Korrekturterme JDE f<>r Vollmond
|
||
$JDE += -0.40614*Sin($Ms);
|
||
$JDE += 0.17302*Sin($M);
|
||
$JDE += 0.01614*Sin(2*$Ms);
|
||
$JDE += 0.01043*Sin(2*$F);
|
||
$JDE += 0.00734*Sin($Ms-$M);
|
||
$JDE += -0.00515*Sin($Ms+$M);
|
||
$JDE += 0.00209*Sin(2*$M);
|
||
$JDE += -0.00111*Sin($Ms-2*$F);
|
||
//
|
||
//Konvertierung von Julianischem Datum auf Gregorianisches Datum
|
||
$z = floor($JDE + 0.5);
|
||
$f = ($JDE + 0.5) - floor($JDE + 0.5);
|
||
if ($z < 2299161) {
|
||
$a = $z;
|
||
}
|
||
else {
|
||
$g = floor(($z - 1867216.25) / 36524.25);
|
||
$a = $z + 1 + $g - floor($g / 4);
|
||
}
|
||
$b = $a + 1524;
|
||
$c = floor(($b - 122.1) / 365.25);
|
||
$d = floor(365.25 * $c);
|
||
$e = floor(($b - $d) / 30.6001);
|
||
|
||
$tag_temp = $b - $d - floor(30.6001 * $e) + $f; //Tag incl. Tagesbruchteilen
|
||
$stunde_temp = ($tag_temp - floor($tag_temp)) * 24;
|
||
$minute_temp = ($stunde_temp - floor($stunde_temp)) * 60;
|
||
|
||
$stunde = floor($stunde_temp);
|
||
$minute = floor($minute_temp);
|
||
$sekunde = round(($minute_temp - floor($minute_temp)) * 60);
|
||
|
||
$tag = floor($tag_temp);
|
||
|
||
if ($e < 14) {
|
||
$monat = $e -1;
|
||
}
|
||
else {
|
||
$monat = $e - 13;
|
||
}
|
||
if ($monat > 2) {
|
||
$jahr = $c - 4716;
|
||
}
|
||
else {
|
||
$jahr = $c - 4715;
|
||
}
|
||
|
||
$datum = mktime($stunde,$minute,$sekunde,$monat,$tag,$jahr);
|
||
|
||
/*
|
||
echo "Naechster Vollmond (".$phase.") ".$tag;
|
||
echo "\n\n";
|
||
echo $tag_temp." ".$datum." ".date('j.n.Y, H:i', $datum)." ".time();
|
||
echo "\n\n";
|
||
echo $stunde." ".$minute." ".$sekunde." ".$monat." ".$tag." ".$jahr;
|
||
echo "\n\n";
|
||
echo abs($datum-time());
|
||
echo "\n\n";
|
||
*/
|
||
$vollmond=(abs($datum-time())<43200);
|
||
?>
|
||
<title>Ist schon wieder Vollmond? - <?php echo($vollmond?"Ja":"Nein"); ?></title>
|
||
<link rel="stylesheet" href="mond.css"/>
|
||
</head>
|
||
<body>
|
||
<h1>Ist schon wieder Vollmond?</h1>
|
||
<hr/>
|
||
<?php if($vollmond) { ?>
|
||
<div class="main">
|
||
<p class="answer yes">Ja!</p>
|
||
</div>
|
||
<?php } else { ?>
|
||
<div class="main">
|
||
<p class="answer no">Nein</p>
|
||
<p class="subanswer">Einfach nur so #<a href="https://fnordon.de/tags/allebekloppt">allebekloppt</a>.</p>
|
||
</div>
|
||
<?php } ?>
|
||
<div class="footer">
|
||
<hr/>
|
||
<p>Vollmond: <?php echo (date('j.n.Y, H:i', $datum));?> UTC</p>
|
||
<p>Dieser Service wird präsentiert von <a href="https://dentaku.wazong.de/">Dentaku</a> (<a href="https://dentaku.wazong.de/impressum/">Impressum</a>).</p>
|
||
</div>
|
||
</body>
|
||
</html>
|