<?php

define ('ADAY', (60*60*24)); 
$datearray = getdate(); 
$month = $datearray['mon']; 
$year = $datearray['year']; 

$start= mktime(0,0,0,$month,1,$year); 
$firstdayarray = getdate($start); 

$months = Array('January','February','March','April','May','June', 
'July','August','September','October','November','December'); 
$days = Array('Su','Mo','Tu','We','Th','Fr','Sa'); 

?> 

<table border=0 cellpadding=0 bordercolor="000000" cellspacing="0" align="center" width="100%"> 
<tr> 
<td colspan="7" bordercolor="ffffff"> 
<div align="center"><font color="#000066"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="1"> 
<?php echo "$datearray[month] $year";?> 
</font></b></font></div> 
</td> 
</tr> 
<?php

foreach($days as $day) 
{ 
?> 
<td bordercolor="ffffff"> 
<div align="center"><font color="#000066"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="1"> 
<?php echo"$day";?> 
</font></b></font></div> 
</td> 
<?php
} 
for( $count=0;$count<(6*7);$count++) 
{ 
$dayarray = getdate($start); 
if((($count) % 7) == 0) 
{ 
if($dayarray['mon'] != $datearray['mon']) 
break; 
echo "</tr><tr>"; 
} 
if($count < $firstdayarray['wday'] || $dayarray['mon'] != $month) 
{ 
echo "<td bordercolor=ffffff><br></td>"; 
} 
else 
{ 
if($dayarray['mday'] == $datearray['mday']) 
{ 
?> 
<td bgcolor="red" bordercolor="#FFCC99"> 
<div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"> 
<?php echo "$dayarray[mday]";?> 
</font></div> 
</td> 
<?php
$start += ADAY; 
} 
else 
{ 
?> 
<td bordercolor="ffffff"> 
<div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"> 
<?php echo "$dayarray[mday]";?> 
</font></div> 
</td> 
<?php
$start += ADAY; 
} 
} 
} 
?> 
</tr> 
</table>