include "calendario.php";
$NumEre0 = count($Ere);
if (!isset($Diff)) $Diff = 0;
if (!isset($Era)) $Era = 1;
if (!isset($JD0U)) $JD0U = 1721425;
if (!isset($EraUD)) $EraUD = "definita dall’utente";
if (!isset($IndUD)) $IndUD = 0;
setcookie ("Anno0", '', 2147483647);
$needrefresh = 0;
if (isset($UpEra)) {
$JD0U = MyJDay($Di0U, $Mese0U-1, $Anno0U);
setcookie ("JD$IndUD", $JD0U, 2147483647);
setcookie ("Nome$IndUD", $EraUD, 2147483647);
$Era = $IndUD + $NumEre0;
$needrefresh = 1;
} else if (isset($DownEra)) {
$indu = $Era - $NumEre0;
$Era--;
while (true) {
$indp = $indu;
++$indu;
if (!isset($_COOKIE["JD$indu"])) break;
$JD0U = $_COOKIE["JD$indu"];
$nomet = $_COOKIE["Nome$indu"];
setcookie ("JD$indp", $JD0U, 2147483647);
setcookie ("Nome$indp", $nomet, 2147483647);
}
setcookie ("JD$indp", '', 2147483647);
setcookie ("Nome$indp", '', 2147483647);
$needrefresh = 1;
}
?>
Calendario Perpetuo
function JD2DataEra($JD, &$Day, &$Month, &$Year, &$YearV){
global $Mese0U;
global $Di0U;
global $diffEra;
JD2Date($JD, $Day, $Month, $Year);
$YearV = $Year - $diffEra;
if ($Month < $Mese0U) --$YearV;
if (($Month == $Mese0U) && ($Day < $Di0U)) --$YearV;
}
echo "";
$indu = 0;
while (isset($_COOKIE["JD$indu"])) {
$Ere[$NumEre0+$indu]['JD'] = $_COOKIE["JD$indu"];
$Ere[$NumEre0+$indu]['Nome'] = $_COOKIE["Nome$indu"];
++$indu;
}
$IndUD = $indu;
// if ($Era >= $IndUD) $Era = $IndUD;
$today = getdate();
if ($Era >= count($Ere)) $Era = count($Ere)-1;
JD2Date($Ere[$Era]['JD'], $Di0U, $Mese0U, $Anno0U);
$diffEra = $Anno0U-1;
if (isset($DD2GG) && isset($Day) && isset($Month) && isset($YearV)) {
$Year = $YearV + $diffEra;
if ($Month < $Mese0U) --$Year;
if (($Month == $Mese0U) && ($Day < $Di0U)) --$Year;
$JD = MyJDay($Day, $Month-1, $Year);
} else if (isset($GG2DD) && isset($JD)) {
JD2DataEra($JD, $Day, $Month, $Year, $YearV);
++$Month;
} else if (isset($OggiBut) || !(isset($JD) || isset($YearV))) {
$Year = $today['year'];
$Month = $today['mon'];
$Day = $today['mday'];
$YearV = $Year - $diffEra;
if ($Month < $Mese0U) --$YearV;
if (($Month == $Mese0U) && ($Day < $Di0U)) --$YearV;
$JD = MyJDay($Day, $Month-1, $Year);
}
if (isset($JD)) {
JD2DataEra($JD, $Day, $Month, $Year, $YearV);
++$Month;
}
if (isset($DecDay)) {
--$JD;
JD2DataEra($JD, $Day, $Month, $Year, $YearV);
++$Month;
} else if (isset($IncDay)) {
++$JD;
JD2DataEra($JD, $Day, $Month, $Year, $YearV);
++$Month;
}
if (!isset($Periodo)) $Periodo = 1;
if (!isset($TipoEvento)) $TipoEvento = 2;
$Month1 = $Month -1;
echo "