Database connection failed.]]>"); mysql_select_db('calendar'); $xml = '
".$row['heading']."
".$row['thedate']."
"; if($i == 0) $xml .= ""; $xml .= "
".$row['body']."


"; $i++; } } else { $month = $_GET['month']; $year = $_GET['year']; if($month == '' && $year == '') { $time = time(); $month = date('n',$time); $year = date('Y',$time); } $date = getdate(mktime(0,0,0,$month,1,$year)); $today = getdate(); $hours = $today['hours']; $mins = $today['minutes']; $secs = $today['seconds']; if(strlen($hours)<2) $hours="0".$hours; if(strlen($mins)<2) $mins="0".$mins; if(strlen($secs)<2) $secs="0".$secs; $days=date("t",mktime(0,0,0,$month,1,$year)); $start = $date['wday']; $name = $date['month']; $year2 = $date['year']; $offset = $days + $start - 1; if($month==12) { $next=1; $nexty=$year + 1; } else { $next=$month + 1; $nexty=$year; } if($month==1) { $prev=12; $prevy=$year - 1; } else { $prev=$month - 1; $prevy=$year; } if($offset <= 28) $weeks=28; elseif($offset > 35) $weeks = 42; else $weeks = 35; $xml .= ""; $col=1; $cur=1; $next=0; for($i=1;$i<=$weeks;$i++) { if($next==3) $next=0; if($col==1) $xml.="\n"; $xml.="\t\n"; $cur++; $col++; } else { $xml.=" \n\t\n"; $col++; } if($col==8) { $xml.="\n\n"; $col=1; } } $xml.="
prev current next jump $name $year2
Mon Tue Wed Thu Fri Sat Sun
"; if($i <= ($days+($start-1)) && $i >= $start) { $xml.="
0) { $row = mysql_fetch_row($result); $xml.=""; } $xml.="\n\t
"; } $xml .= "]]>
"; echo $xml; ?>