$U = $_REQUEST['U'] ;
$Y = $_REQUEST['Y'] ;
$M = $_REQUEST['M'] ;
$D = $_REQUEST['D'] ;
if ( ! is_numeric($D) ) {
$D = 99 ;
$d = 99 ;
}
$MON = strftime ("%w", mktime(0,0,0,$M,$d,$Y));
$tY = date(Y) ;
$tM = date(n) ;
$tD = date(j) ;
// print "URL=" . $U . "#" ;
// print " Y=" . $Y . "#" ;
// print " M=" . $M . "#" ;
// print " D=" . $D . "#" ;
// print "##" . $MON . "##" ;
$d = 1 ;
if ( checkdate($M, 31, $Y) ) {
$lastday = 31 ;
} else if ( checkdate($M, 30, $Y) ) {
$lastday = 30 ;
} else if ( checkdate($M, 29, $Y) ) {
$lastday = 29 ;
} else {
$lastday = 28 ;
}
$prevmonth = $M - 1 ;
$prevyear = $Y ;
if ( $prevmonth == 0 ) {
$prevmonth = 12 ;
$prevyear = $Y - 1 ;
}
$nextmonth = $M + 1 ;
$nextyear = $Y ;
if ( $nextmonth > 12 ) {
$nextmonth = 1 ;
$nextyear = $Y + 1 ;
}
print "" ;
print "<" ;
print " date:" . $Y . "/" . $M ." " ;
print ">" ;
print " " ;
print "Today" ;
print "" ;
?>
| Su | Mo | Tu | We | Th | Fr | Sa |
$d = 1 ;
while ( $d <= $lastday ) {
print "" ;
for ($week = 0 ; $week <= 6 ; $week++) {
if ( $d == 1 & strftime("%w", mktime(0,0,0,$M,$d,$Y)) > $week ) {
print " | " ;
} else if ( $d > $lastday ) {
print " | " ;
} else if ( $Y == $tY & $M == $tM & $d == $tD ) {
$url=$U . "?Y=" . $Y . "&M=" . $M . "&D=" . $d ;
print "" . $d . " | " ;
$d++ ;
} else if ( $Y > $tY ) {
print "" . $d . " | " ;
$d++ ;
} else if ( $Y == $tY & $M > $tM ) {
print "" . $d . " | " ;
$d++ ;
} else if ( $Y == $tY & $M == $tM & $d > $tD ) {
print "" . $d . " | " ;
$d++ ;
} else {
$url=$U . "?Y=" . $Y . "&M=" . $M . "&D=" . $d ;
print "" . $d . " | " ;
$d++ ;
}
}
print "
" ;
}
?>