rendered paste body<?php
$m = (!$m) ? date("m",mktime()) : "$m";
$y = (!$y) ? date("Y",mktime()) : "$y";
function mk_drawCalendar($m,$y)
{
if ((!$m) || (!$y))
{
$m = date("m",mktime());
$y = date("Y",mktime());
}
$tmpd = getdate(mktime(0,0,0,$m,1,$y));
$hour = $tmpd["hour"];
$month = $tmpd["month"];
$firstwday= $tmpd["wday"];
$lastday = mk_getLastDayofMonth($m,$y);
?>
<table cellpadding=2 cellspacing=0 border=1 width=200><tr><td colspan=7 bgcolor="#3300CC">
<table cellpadding=0 cellspacing=0 border=0 width="100%"><tr>
<th align='left' class='arrowleft'><a href="<?=$SCRIPT_NAME?>?m=<?=(($m-1)<1) ? 12 : $m-1 ?>&y=<?=(($m-1)<1) ? $y-1 : $y ?>"><font size="3" color="white"><</a></font></th>
<th align='center'><font size="4"><?="$month $y"?></font></th>
<th align='right' class='arrowright'><a href="<?=$SCRIPT_NAME?>?m=<?=(($m+1)>12) ? 1 : $m+1 ?>&y=<?=(($m+1)>12) ? $y+1 : $y ?>"><font size="3" color="white">></a></font></th>
</tr></table>
</td></tr>
<tr>
<th bgcolor="#000000"><font color="#FFFFFF">S</font></th>
<th bgcolor="#000000"><font color="#FFFFFF">M</font></th>
<th bgcolor="#000000"><font color="#FFFFFF">T</font></th>
<th bgcolor="#000000"><font color="#FFFFFF">W</font></th>
<th bgcolor="#000000"><font color="#FFFFFF">T</font></th>
<th bgcolor="#000000"><font color="#FFFFFF">F</font></th>
<th bgcolor="#000000"><font color="#FFFFFF">S</font></th>
</tr>
<?php $d = 1;
$wday = $firstwday;
$firstweek = true;
/*== loop through all the days of the month ==*/
while ( $d <= $lastday)
{
/*== set up blank days for first week ==*/
if ($firstweek) {
if ($firstwday !==0){
echo "<tr><td colspan='$firstwday' bgcolor='#C0C0C0'><font size=2> </font></td>";
$firstweek = false;
}
}
/*== Sunday start week with <tr> ==*/
if ($wday==0) { echo "<tr>"; }
/*== check for event ==*/
echo "<th align='center'>";
echo "<a href=\"?d=$d&m=$m&y=$y\"><font size='2'color='#000000'>$d</font></a>";
echo "</th>\n";
/*== Saturday end week with </tr> ==*/
if ($wday==6) { echo "</tr>\n"; }
$wday++;
$wday = $wday % 7;
$d++;
}
if ($wday = $wday % 7)
{$remainingDays = 7 - $wday;
echo "<td colspan='$remainingDays' bgcolor='#C0C0C0'> </td>";}
echo "</tr></table>";
/*== end drawCalendar function ==*/
}