0 && $month>0 && $year>0){
$now=date("d/m/Y",mktime(0,0,0,$month,$day,$year));
}else{
$now=date("d/m/Y");
}
list($day,$month,$year)=explode('/',$now);
// -- fixed start vars -- (DO NOT CHANGE!)
$StartValues = Array(
21, // 0 start_day
12, // 1 start_month
2012, // 2 start_year
207, // 3 start_kin(260)
3, // 4 start_color(4)
12, // 5 start_tone(13)
7, // 6 start_seal(20)
112 // 7 start_year(#nr)
);
// --- KIN Calculation ---
$Ret = array_merge(Array(), $StartValues);
$fix_tm = mktime(0,0,0,$Ret[1],$Ret[0],$Ret[2]);
$now_tm = mktime(0,0,0,$month,$day,$year);
if($fix_tm > $now_tm){ // --- go in the past
while($Ret[2] != $year){
$Ret[2]--;
$Ret[7]-=105;
if($Ret[7]<1){$Ret[7]+=260;}
}
while($Ret[1] != $month){
$Ret[1]--;
if($Ret[1]<1){$Ret[1]+=12;}
}
}else if($now_tm > $fix_tm){ // --- go in the future
while($Ret[2] != $year){
$Ret[2]++;
$Ret[7]+=105;
if($Ret[7]>260){$Ret[7]-=260;}
}
while($Ret[1] != $month){
$Ret[1]++;
if($Ret[1]>12){$Ret[1]-=12;}
}
}
$Ret[3]=$day + $monD[$Ret[1]-1] + $Ret[7]; // kin = day#nr + month#nr + year#nr
while($Ret[3] > 260){ $Ret[3] -= 260; }
// -- get color, tone & seal
$kin = $StartValues[3];
if( $kin > $Ret[3] ){ // -- go up
while( $kin > $Ret[3] ){
$kin--;
$Ret[4]--; if($Ret[4]<1){$Ret[4]+=4;}
$Ret[5]--; if($Ret[5]<1){$Ret[5]+=13;}
$Ret[6]--; if($Ret[6]<1){$Ret[6]+=20;}
}
}else{ // -- go down
while( $kin < $Ret[3] ){
$kin++;
$Ret[4]++; if($Ret[4]>4){$Ret[4]-=4;}
$Ret[5]++; if($Ret[5]>13){$Ret[5]-=13;}
$Ret[6]++; if($Ret[6]>20){$Ret[6]-=20;}
}
}
// --- Build the return kin info ---
$towrite='';
$fN=$Im=$Ret[6]; if($fN==20){$Im=0;$fN.=' = 0';}
$towrite .= '
Date | year '.$year.' month '.$month.' day '.$day.' |
KIN | '.$Ret[3].' ['.$ToneS[0][($Ret[5]-1)].' '.$SealS[0][($Ret[6]-1)].'] |
'.$ColorS[($Ret[4]-1)][0].' '.$ToneS[1][($Ret[5]-1)].' '.$SealS[1][($Ret[6]-1)].' | |
Color | '.$Ret[4].' ['.$ColorS[($Ret[4]-1)][0].'] ('.$ColorS[($Ret[4]-1)][2].', '.$ColorS[($Ret[4]-1)][1].') |
Tone | '.$Ret[5].' ['.$ToneS[1][($Ret[5]-1)].'] |
Seal | '.$fN.' ['.$SealS[1][($Ret[6]-1)].'] |
Galactic Activation Portal |
tGWdb scripts 2008