Kalender
Hjælper der nogen der kan se hved der er galt kalenderen starter forkert i juni måned
den ligger på www.langeskovborgerforening.dk
<?
include "config.php";
function bbflag($t) {
$t = ereg_replace("\[flag= ?([^\[]*) ?\]", "<img src=\"./images/flag/\\1.gif\" alt=\"\" border=\"0\" />", $t);
$t = str_replace("", "<b>", $t);
$t = str_replace("", "</b>", $t);
return $t;
}
echo "<HTML><HEAD><title>";
echo $title;
echo "</title><link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\"></HEAD>";
$amount = $_GET["c"];
$way = $_GET["w"];
if(isset($amount)){
$m = $amount+$way;
} else {
$m = date("m");
}
$y = date("Y");
$count_days = date("t",mktime(0,0,0,$m,1,$y));
$month = date("M",mktime(0,0,0,$m,1,$y));
$year = date("Y",mktime(0,0,0,$m,1,$y));
$weekday = date("w",mktime(0,0,0,$m,1,$y));
if($weekday != "0" && $weekday != "1") {
$startmonday = $weekday-1;
} else {
$startmonday = 6; }
$count_lastmonth = date("t",mktime(0,0,0,$m-1,1,$y));
$lmditm = $count_lastmonth+$startmonday-1;
for($s = $count_lastmonth; $s <= $lmditm ;$s++) {
$t = $s-$startmonday;
$adj .= "<td width=\"22\"><font id=\"next\">$t</font></td>";
}
echo "<div align=\"center\"><table width=\"167\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td>";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"167\"><tr>";
echo "<td><img border=\"0\" src=\"Kalender/images/03.gif\" width=\"13\" height=\"25\" alt=\"\"></td>";
echo "<td><a href=\"?c=$m&w=-1\"><img border=\"0\" src=\"Kalender/images/04.gif\" width=\"5\" height=\"25\" alt=\"\"></a></td>";
echo "<td id=\"month\" width=\"129\" height=\"25\">";
echo "<div align=\"center\"><font class=\"monthtext\">";
switch ($month) {case Jan:echo "Januar";break;case Feb:echo "Februar";break;case Mar:echo "Marts";break;case Apr:echo "April";break;case May:echo "Maj";break;case Jun:echo "Juni";break;case Jul:echo "Juli";break;case Aug:echo "August";break;case Sep:echo "September";break;case Oct:echo "Oktober";break;case Nov:echo "November";break;case Dec:echo "December";break;}
echo " - ".$year;
echo "</font></div></td><td><a href=\"?c=$m&w=1\"><img border=\"0\" src=\"Kalender/images/06.gif\" width=\"5\" height=\"25\" alt=\"\"></a></td>";
echo "<td><img border=\"0\" src=\"Kalender/images/07.gif\" width=\"15\" height=\"25\" alt=\"\"></td>";
echo "</tr></table></div></td></tr><tr><td background=\"Kalender/images/09.gif\" width=\"167\">";
echo "<div align=\"center\"><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"154\">";
echo "<tr><td><div align=\"right\"><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"154\"><tr>";
echo "<td width=\"22\">Ma</td><td width=\"22\">Ti</td><td width=\"22\">On</td><td width=\"22\">To</td><td width=\"22\">Fr</td><td width=\"22\">Lø</td><td width=\"22\">Sø</td></tr><tr>";
echo "<td width=\"154\" height=\"10\" colspan=\"7\"><img border=\"0\" alt=\"\" src=\"Kalender/images/01.gif\" width=\"154\" height=\"5\"></td></tr><tr>";
for($i = 1; $i <= $count_days;$i++){
$result = mysql_query("SELECT * FROM kalender WHERE dato = \"".addslashes($i.$month.$year)."\"");
$count = mysql_num_rows($result);
$d = mysql_fetch_array($result);
$text = nl2br(bbflag($d["textoftheday"]));
if($count >= 1 && $i.$month.$year == date("dMY")){
echo $adj."<td width=\"22\"><a id=\"event\" href=\"\" style=\"text-decoration: none\"><div id=\"todaylink\">$i</div><span>Events idag:<br>$text</span></a>";
} elseif($count >= 1 && $i.$month.$year != date("dMY")) {
echo $adj."<td width=\"22\"><a id=\"event\" href=\"\" style=\"text-decoration: none\">$i<span>Det sker idag:<br>$text</span></a>";
} elseif($count == 0 && $i.$month.$year == date("dMY")) {
echo $adj."<td width=\"22\" id=\"today\">$i";
} elseif($count == 0 && $i.$month.$year != date("dMY")) {
echo $adj."<td width=\"22\">$i";
}
echo "</td>";
$adj = "";
$startmonday ++;
$nmditm = $startmonday;
if($startmonday == 7) {
echo "</tr><tr>";
$startmonday = 0;
}
}
if($nmditm != 7) {
$nmditm = 7-$nmditm;
for($q = 1;$q <= $nmditm;$q++){
echo $adj."<td width=\"22\"><font id=\"next\">$q</font></td>";
}
}
echo "</tr></table></div></td></tr></table></div></td></tr><tr>";
echo "<td background=\"Kalender/images/11.gif\" width=\"167\" height=\"11\"></td></tr></table></div></BODY></HTML>";
?>
