*---kalender.php---*
<?
mysql_connect("host", "user", "password");mysql_select_db("database");
echo "<center>";
if ($submit == 'plaatsen') {
$datum=$dag.'-'.$maand.'-'.$jaar;
mysql_query("INSERT INTO kalender (schrijver, datum, bericht, steekwoord) VALUES ('$schrijver', '$datum', '$bericht', '$steekwoord')");
}
if ($page==null) {
$bj = date("Y")-1;
echo "<table width=700>";
$vrm = $maand - 1;
if ($vrm == 0) {$vrm=12;$vrj=$jaar-1;}
else {$vrj=$jaar;}
echo "</td><td align=left width=150 bgcolor=ffffff onmouseover=this.style.color='#000088';this.style.cursor='hand'; onmouseout=this.style.color='#000000' onclick=location.href='kalender.php?maand=$vrm&jaar=$vrj'><-- Vorige Maand</td>";
echo "<td align=center width=400>";
echo "<form action=kalender.php><select name=maand>
<option value=1>Januari</option>
<option value=2>Februari</option>
<option value=3>Maart</option>
<option value=4>April</option>
<option value=5>Mei</option>
<option value=6>Juni</option>
<option value=7>Juli</option>
<option value=8>Augustus</option>
<option value=9>September</option>
<option value=10>Oktober</option>
<option value=11>November</option>
<option value=12>December</option>
</select>
<select name=jaar>";
for ($a=$bj;$a<date("Y")+9;$a++) {
echo "<option value=$a>$a</option>";
}
echo "</select>
<input value=ga type=submit></form>";
$vlm = $maand + 1;
if ($vlm == 13) {$vlm=1;$vlj=$jaar+1;}
else {$vlj=$jaar;}
echo "</td><td align=right width=150 bgcolor=ffffff onmouseover=this.style.color='#000088';this.style.cursor='hand'; onmouseout=this.style.color='#000000' onclick=location.href='kalender.php?maand=$vlm&jaar=$vlj'>Volgende Maand --></td>";
echo "</table>";
$edvm = jddayofweek(gregoriantojd($maand, 1, $jaar), 0);
// $edvm = date ("w", mktime(0,0,0,$maand,2,$jaar));
$ldvm = date ("t", mktime(0,0,0,$maand,2,$jaar));
$dag=0;
$maanden = array('','Januari','Februari','Maart','April','Mei','Juni','Juli','Augustus','September','Oktober','November','December');
echo "<table width=700>";
echo "<tr><td colspan=7><center><h1>$maanden[$maand] - $jaar</h1>
Klik op de datum in de kalender om iets op die datum toe te voegen. </td></tr>";
echo "<tr>
<td bgcolor=aaaaaa><font color=ffffff><b>Zondag</td>
<td bgcolor=aaaaaa><font color=ffffff><b>Maandag</td>
<td bgcolor=aaaaaa><font color=ffffff><b>Dinsdag</td>
<td bgcolor=aaaaaa><font color=ffffff><b>Woensdag</td>
<td bgcolor=aaaaaa><font color=ffffff><b>Donderdag</td>
<td bgcolor=aaaaaa><font color=ffffff><b>Vrijdag</td>
<td bgcolor=aaaaaa><font color=ffffff><b>Zaterdag</td>";
While ($dag<$ldvm){
echo "<tr>";
for($a=0;$a<7;$a++) {
if ($a == $edvm) {$start=1;}
if ($dag == $ldvm) {$start=0;}
if ($start==1) {
$dag++;
$bgcolor='eeeeee';
if ($a == 0 or $a == 6) {$bgcolor='dddddd';}
echo "<td width=100 height=100 bgcolor=$bgcolor valign=top onmouseover=dag$dag.style.backgroundColor='#aaaaaa';dag$dag.style.color='#eeeeee'; onmouseout=dag$dag.style.backgroundColor='$bgcolor';dag$dag.style.color='#000000'><table width=20 height=20 bgcolor=aaaaaa cellspacing=1><td id=dag$dag align=center bgcolor=$bgcolor onclick=location.href='kalender.php?page=toevoegen&dag=$dag&maand=$maand&jaar=$jaar' onmouseover=this.style.cursor='hand'>$dag</td></table>";
$datum = $dag.'-'.$maand.'-'.$jaar;
$sql = mysql_query("select * from kalender WHERE datum = '$datum' order by id desc");
while ($echo = mysql_fetch_object($sql)) {
echo "<table width=100% cellspacing=0 cellpadding=0><td valign=top onclick=location.href='kalender.php?page=uitlezen&dag=$dag&maand=$maand&jaar=$jaar' onmouseover=this.style.cursor='hand'>".$echo->steekwoord."</td></table>";
}
echo "</td>";
}
else {
echo "<td width=100 height=100 bgcolor=cccccc></td>";
}
}
echo "</tr>";
}
date ("w", mktime(0,0,0,7,1,2000));
}
if ($page=='toevoegen') {
echo "<form action=kalender.php?maand=$maand&jaar=$jaar method=post>";
echo "<input type=hidden name=dag value=$dag>";
echo "<input type=hidden name=maand value=$maand>";
echo "<input type=hidden name=jaar value=$jaar>";
echo "<table width=400 cellspacing=1 bgcolor=aaaaaa>";
echo "<tr><td bgcolor=dddddd>Schrijver:</td><td bgcolor=eeeeee><input name=schrijver width=10 maxlength=10></td></tr>";
echo "<tr><td bgcolor=dddddd>Steekwoord:</td><td bgcolor=eeeeee><input name=steekwoord width=10 maxlength=10></td></tr>";
echo "<tr><td bgcolor=dddddd valign=top>Bericht:</td><td bgcolor=eeeeee><textarea name=bericht></textarea></td></tr>";
echo "<tr><td colspan=2 align=center><input type=submit name=submit value='plaatsen'></td></tr></table></form>";
}
if($page=='uitlezen') {
$datum = $dag.'-'.$maand.'-'.$jaar;
$sql = mysql_query("select * from kalender WHERE datum = '$datum' order by id desc");
while ($echo = mysql_fetch_object($sql)) {
echo "<table width=400 cellspacing=1 bgcolor=aaaaaa><tr><td bgcolor=eeeeee>";
echo $echo->schrijver;
echo "</td></tr><tr><td bgcolor=eeeeee>$echo->steekwoord</td></tr><tr><td bgcolor=eeeeee>$echo->bericht</td></tr></table>";
}
}
?>