Kalender - Agenda (met mysql)
Waarde interetnerds, surfjeanetten en ander maatschappelijk verstoot ! Na zoveel scriptjes gebruikt te hebben van deze site wast dringend tijd dak ook es een scriptje post-te. Voor dit script heb ik mij gebaseerd opt script "Europeese kalender" van HaasOnline (http://www.phphulp.nl/php/scripts/1/333/) en hebt een bitteke uitgebouwd; een mooie layout, koppeling aan een database, ... Tmaakt gebruik van een mysql database, met de volgende instelling: CREATE TABLE `agenda` ( `id` int(11) NOT NULL auto_increment, `date` varchar(10) NOT NULL default '', `genre` text NOT NULL, `titre` text NOT NULL, `details` text NOT NULL, UNIQUE KEY `id` (`id`) ) TYPE=MyISAM PACK_KEYS=0; Voor de verjaardagen gebruik ik een andere database, nl. de members database, maar vermits die in mijn hele site verwerkt zit kan ik die hier moeilijk posten. Maar kveronderstel dat't ni zo moeilijk is voor de phpfanaten om die ff te koppelen aan uw eigen ledensysteem. M'n excuses voort frans, maar kheb het nu eenmaal geschreven voor een waalse studentenvereniging. Alle bemerkingen, commentaar, reacties zijn welkom. Voor vragen moogt ge altijd mailen! **** Aanpassing **** Voila, kheb het scriptje wat vertaald naart nederlands. Hier mss nog enkele nuttige woordjes: jour = dag mois = maand annee = jaar nom = naam prénom = voornaam section = afdeling / studierichting annif = anniversaire = verjaardag jour férié = vrije dag / feestdag Dan mss nog een kleine uitleg bij het verschil tss de $querytris en de $queryquattro: De $queryquattro wordt gebruikt voor de feestdagen die elk jaar op dezelfde datum vallen (nieuwjaar, kerstmis, ...) De $querytris wordt gebruikt voor de feestdagen die niet elk jaar op dezelde datum vallen (pasen, pinksteren, ...) En dan voor de gemakkelijkheid toch even de structuur van mijn ledensysteem: CREATE TABLE `members` ( `id` int(11) NOT NULL auto_increment, `login` text NOT NULL, `pass` text NOT NULL, `nom` text NOT NULL, `prenom` text NOT NULL, `email` text NOT NULL, `section` text NOT NULL, `annif` varchar(5) NOT NULL default '', UNIQUE KEY `id` (`id`) ) TYPE=MyISAM PACK_KEYS=0;
----------- agenda.php -----------
[code]<?php
header("Cache-Control: no-cache, must-revalidate, no-store\nPragma: no-cache\n");
?>
<HTML>
<HEAD>
<TITLE>Agenda</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body,td,p,select,input,textarea {
color: #333333;
font-size: 11px;
font-family: Verdana, Arial, Helvetica, sans-serif;
margin:0,0,0,0;
}
a{
color: #333333;
font-size: 11px;
font-family: Verdana, Arial, Helvetica, sans-serif;
text-decoration:underline;
}
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
color: #0D4E95;
font-weight: bold;
padding-bottom:0px;
padding-top:0px;
}
a.topnav {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
color: #333333;
font-weight: bold;
text-decoration:none;
}
a.topnav:hover {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
color: #333333;
font-weight: bold;
text-decoration:underline;
}
.sidered {color: #0D4E95; font-size: 11px; font-family: Verdana, Arial, Helvetica, sans-serif;}
.side {color: #333333; font-size: 11px; font-family: Verdana, Arial, Helvetica, sans-serif;}
a.sideredlinks{color: #0D4E95; font-size: 11px; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold;text-decoration:underline; }
h1 {
font-size: 18px;
color: #0D4E95;
}
.base {font-size: 10px;margin-left:28px;}
td.kalalg { padding: 0px; margin: 0px; center: top; font: 11px Verdana, Arial; font-weight: bold; background-color: #FFFFFF; color: #0000CC; line-height: 16px; }
td.kaltit { padding: 0px; margin: 0px; center: top; font: 11px Verdana, Arial; font-weight: normal; background-color: #FFFFFF; color: #AAAAAA; border-bottom: solid 1px #AAAAAA;}
td.kaltexr { width: 117px; padding: 0px; height: 100px; cursor: hand; margin: 0px; font: 11px Verdana, Arial; font-weight: normal; color: #0D4E95; }
-->
</style>
</HEAD>
<body>
<center>
<?php
// Connection mysql
$user = "user";
$dbpass = "pass";
$host = "localhost";
$dbdb = "database";
if (!mysql_select_db($dbdb, mysql_connect($host, $user, $dbpass)))
{
echo "Connectie met de database mislukt.";
exit();
}
echo "<table width=\"200\">\n";
echo "<tr><td class=\"kalalg\">";
if($_GET['thismonth'] != "" and $_GET['thisyear'] != "") {
$this_month = $_GET['thismonth'];
$this_year = $_GET['thisyear'];
if ($this_month == 13) {
$this_month = 1;
$this_year = $this_year + 1;
}
elseif ($this_month == 0)
{
$this_month = 12;
$this_year = $this_year - 1;
}
else
{
$this_month = $this_month;
}
}
else {
$this_month = date("n");
$this_year = date("Y");
}
$arraymonth = array(
"Januari",
"Februari",
"Maart",
"April",
"Mei",
"Juni",
"Juli",
"Augustus",
"September",
"Oktober",
"November",
"December"
);
$month_name = $arraymonth[$this_month-1];
/* Navigation */
$last_month = $this_month - 1;
$next_month = $this_month + 1;
echo "<center>";
echo "<table width=\"800\"><tr><td align=\"left\" width=\"200\">\n";
echo "<a href=\"agenda.php?thismonth=$last_month&thisyear=$this_year\" style=\"color:#0D4E95; font-family: Verdana, Arial, Helvetica, sans-serif;\"><b>« Vorige</b></a>";
echo "</td><td align=\"center\" width=\"400\">";
echo "<h1>$month_name $this_year</h1>";
echo "</td><td align=\"right\" width=\"200\">";
echo "<a href=\"agenda.php?thismonth=$next_month&thisyear=$this_year\" style=\"color:#0D4E95; font-family: Verdana, Arial, Helvetica, sans-serif;\"><b>Volgende »</b></a>";
echo "</td></tr></table>";
echo "</center>";
/* Titels van de kalender */
echo "<table width=\"820\" cellspacing=\"1\" cellpadding=\"0\" style=\"border: solid #AAAAAA 1px;\">\n";
echo "<td class=\"kaltit\" height=\"5\" style=\"text-align: center; border-right: solid #AAAAAA 1px;\">Maandag</td>";
echo "<td class=\"kaltit\" height=\"5\" style=\"text-align: center; border-right: solid #AAAAAA 1px;\">Dinsdag</td>";
echo "<td class=\"kaltit\" height=\"5\" style=\"text-align: center; border-right: solid #AAAAAA 1px;\">Woensdag</td>";
echo "<td class=\"kaltit\" height=\"5\" style=\"text-align: center; border-right: solid #AAAAAA 1px;\">Donderdag</td>";
echo "<td class=\"kaltit\" height=\"5\" style=\"text-align: center; border-right: solid #AAAAAA 1px;\">Vrijdag</td>";
echo "<td class=\"kaltit\" height=\"5\" style=\"text-align: center; border-right: solid #AAAAAA 1px;\">Zaterdag</td>";
echo "<td class=\"kaltit\" height=\"5\" style=\"text-align: center;\">Zondag</td>";
echo "</td></tr>";
/* De maand berekenen */
$first_day = date("w", mktime(0, 0, 0, $this_month, 1, $this_year));
$total_days = date("t", mktime(0, 0, 0, $this_month, 1, $this_year));
$week_num = 1;
$day_num = 1;
$the_day = " ";
/* Het aantal weken overlopen (primaire teller in het proces) */
while ($week_num <= 6) {
echo "<tr>\n";
/* Het aantal weken overlopen (secundaire teller) */
for ( $i = 1; $i <= 6; $i++ ) {
if ($week_num == 1) {
if ($i < $first_day)
$the_day = " ";
else if ($i == $first_day) {
$the_day = 1;
}
} else {
if ($the_day > $total_days)
$the_day = " ";
}
/* De dagen weergeven */
if ($the_day != " ")
{
if ($the_day == date(j) and $this_month == date("n") and $this_year == date("Y"))
{
echo "<td valign=\"top\" class=\"kaltexr\" onclick=\"window.location.href='jour.php?jour=$the_day&mois=$this_month&annee=$this_year'\" onMouseOver=\"this.style.backgroundColor='#FEFFBF';\" onMouseOut=\"this.style.backgroundColor='#FEFF97'\" bgcolor=#FEFF97><b>$the_day</b><br>";
}
else
{
echo "<td valign=\"top\" class=\"kaltexr\" onclick=\"window.location.href='jour.php?jour=$the_day&mois=$this_month&annee=$this_year'\" onMouseOver=\"this.style.backgroundColor='#E9ECEF';\" onMouseOut=\"this.style.backgroundColor='#CDD2D9'\" bgcolor=#CDD2D9><b>$the_day</b><br>";
}
$querytris="SELECT titre FROM agenda WHERE date='$the_day/$this_month/$this_year' and genre='jour férié' ORDER BY id";
$resulttris=mysql_query($querytris) or die(mysql_error());
if (mysql_num_rows($resulttris) >= 1)
{
echo "<font style=\"color:#404040; font-size:90%;\"><center><b>";
while ($rowtris = mysql_fetch_array($resulttris))
{
echo "".$rowtris['titre']."";
}
echo "</b></center></font><br>";
}
$queryquattro="SELECT titre FROM agenda WHERE date='$the_day/$this_month' and genre='jour férié' ORDER BY id";
$resultquattro=mysql_query($queryquattro) or die(mysql_error());
if (mysql_num_rows($resultquattro) >= 1)
{
echo "<font style=\"color:#404040;font-size:90%;\"><center><b>";
while ($rowquattro = mysql_fetch_array($resultquattro))
{
echo "".$rowquattro['titre']."";
}
echo "</b></center></font><br>";
}
$query="SELECT login FROM members WHERE annif='$the_day/$this_month' ORDER BY id";
$result=mysql_query($query) or die(mysql_error());
if (mysql_num_rows($result) >= 1)
{
echo "<font style=\"sidered\" style=\"font-size:90%;\">Verjaardag:</font>";
echo "<br><table padding=\"0\" spacing=\"0\" style=\"margin-left: 2px; line-height: 60% ;\">";
while ($row = mysql_fetch_array($result))
{
echo "<tr><td><font style=\"color: black; font-size:90%;\">» ".$row['login']."</font></td></tr>";
}
echo "</table>";
}
$querybis="SELECT titre FROM agenda WHERE date='$the_day/$this_month/$this_year' and genre='activité' ORDER BY id";
$resultbis=mysql_query($querybis) or die(mysql_error());
if (mysql_num_rows($resultbis) >= 1)
{
echo "<font style=\"sidered\" style=\"font-size:90%;\">Activiteiten:</font>";
echo "<br><table padding=\"0\" spacing=\"0\" style=\"margin-left: 2px; line-height: 60% ;\">";
while ($rowbis = mysql_fetch_array($resultbis))
{
echo "<tr><td><font style=\"color: black; font-size:90%;\">» ".$rowbis['titre']."</font></td></tr>";
}
echo "</table>";
}
echo "</td>";
}
else
{
echo "<td valign=\"top\" bgcolor=\"#DFDFDF\"></td>";
}
/* De volgende dag berekenen */
if ($the_day != " ")
$the_day++;
}
if ($week_num == 1) {
if ($first_day == 0) {
$the_day = 1;
if ($the_day == date(j) and $this_month == date("n") and $this_year == date("Y"))
{
echo "<td valign=\"top\" class=\"kaltexr\" onclick=\"window.location.href='jour.php?jour=$the_day&mois=$this_month&annee=$this_year'\" onMouseOver=\"this.style.backgroundColor='#FEFFBF';\" onMouseOut=\"this.style.backgroundColor='#FEFF97'\" bgcolor=#FEFF97><b>$the_day</b><br>";
}
else
{
echo "<td valign=\"top\" class=\"kaltexr\" onclick=\"window.location.href='jour.php?jour=$the_day&mois=$this_month&annee=$this_year'\" onMouseOver=\"this.style.backgroundColor='#E9ECEF';\" onMouseOut=\"this.style.backgroundColor='#C3C3C3'\" bgcolor=#C3C3C3><b>$the_day</b><br>";
}
$querytris="SELECT titre FROM agenda WHERE date='$the_day/$this_month/$this_year' and genre='jour férié' ORDER BY id";
$resulttris=mysql_query($querytris) or die(mysql_error());
if (mysql_num_rows($resulttris) >= 1)
{
echo "<font style=\"color:#404040; font-size:90%;\"><center><b>";
while ($rowtris = mysql_fetch_array($resulttris))
{
echo "".$rowtris['titre']."";
}
echo "</b></center></font><br>";
}
$queryquattro="SELECT titre FROM agenda WHERE date='$the_day/$this_month' and genre='jour férié' ORDER BY id";
$resultquattro=mysql_query($queryquattro) or die(mysql_error());
if (mysql_num_rows($resultquattro) >= 1)
{
echo "<font style=\"color:#404040;font-size:90%;\"><center><b>";
while ($rowquattro = mysql_fetch_array($resultquattro))
{
echo "".$rowquattro['titre']."";
}
echo "</b></center></font><br>";
}
$query="SELECT login FROM members WHERE annif='$the_day/$this_month' ORDER BY id";
$result=mysql_query($query) or die(mysql_error());
if (mysql_num_rows($result) >= 1)
{
echo "<font style=\"sidered\" style=\"font-size:90%;\">Verjaardag:</font>";
echo "<br><table padding=\"0\" spacing=\"0\" style=\"margin-left: 2px; line-height: 60% ;\">";
while ($row = mysql_fetch_array($result))
{
echo "<tr><td><font style=\"color: black; font-size:90%;\">» ".$row['login']."</font></td></tr>";
}
echo "</table>";
}
$querybis="SELECT titre FROM agenda WHERE date='$the_day/$this_month/$this_year' and genre='activité' ORDER BY id";
$resultbis=mysql_query($querybis) or die(mysql_error());
if (mysql_num_rows($resultbis) >= 1)
{
echo "<font style=\"sidered\" style=\"font-size:90%;\">Activiteiten:</font>";
echo "<br><table padding=\"0\" spacing=\"0\" style=\"margin-left: 2px; line-height: 60% ;\">";
while ($rowbis = mysql_fetch_array($resultbis))
{
echo "<tr><td><font style=\"color: black; font-size:90%;\">» ".$rowbis['titre']."</font></td></tr>";
}
echo "</table>";
}
echo "</td>";
echo "</tr>";
$the_day++;
}
else {
if ($the_day == date(j) and $this_month == date("n") and $this_year == date("Y"))
{
echo "<td valign=\"top\" class=\"kaltexr\" onclick=\"window.location.href='jour.php?jour=$the_day&mois=$this_month&annee=$this_year'\" onMouseOver=\"this.style.backgroundColor='#FEFFBF';\" onMouseOut=\"this.style.backgroundColor='#FEFF97'\" bgcolor=#FEFF97><b>$the_day</b><br>";
}
else
{
echo "<td valign=\"top\" class=\"kaltexr\" onclick=\"window.location.href='jour.php?jour=$the_day&mois=$this_month&annee=$this_year'\" onMouseOver=\"this.style.backgroundColor='#E9ECEF';\" onMouseOut=\"this.style.backgroundColor='#C3C3C3'\" bgcolor=#C3C3C3><b>$the_day</b><br>";
}
$querytris="SELECT titre FROM agenda WHERE date='$the_day/$this_month/$this_year' and genre='jour férié' ORDER BY id";
$resulttris=mysql_query($querytris) or die(mysql_error());
if (mysql_num_rows($resulttris) >= 1)
{
echo "<font style=\"color:#404040; font-size:90%;\"><center><b>";
while ($rowtris = mysql_fetch_array($resulttris))
{
echo "".$rowtris['titre']."";
}
echo "</b></center></font><br>";
}
$queryquattro="SELECT titre FROM agenda WHERE date='$the_day/$this_month' and genre='jour férié' ORDER BY id";
$resultquattro=mysql_query($queryquattro) or die(mysql_error());
if (mysql_num_rows($resultquattro) >= 1)
{
echo "<font style=\"color:#404040;font-size:90%;\"><center><b>";
while ($rowquattro = mysql_fetch_array($resultquattro))
{
echo "".$rowquattro['titre']."";
}
echo "</b></center></font><br>";
}
$query="SELECT login FROM members WHERE annif='$the_day/$this_month' ORDER BY id";
$result=mysql_query($query) or die(mysql_error());
if (mysql_num_rows($result) >= 1)
{
echo "<font style=\"sidered\" style=\"font-size:90%;\">Verjaardag:</font>";
echo "<br><table padding=\"0\" spacing=\"0\" style=\"margin-left: 2px; line-height: 60% ;\">";
while ($row = mysql_fetch_array($result))
{
echo "<tr><td><font style=\"color: black; font-size:90%;\">» ".$row['login']."</font></td></tr>";
}
echo "</table>";
}
$querybis="SELECT titre FROM agenda WHERE date='$the_day/$this_month/$this_year' and genre='activité' ORDER BY id";
$resultbis=mysql_query($querybis) or die(mysql_error());
if (mysql_num_rows($resultbis) >= 1)
{
echo "<font style=\"sidered\" style=\"font-size:90%;\">Activiteiten:</font>";
echo "<br><table padding=\"0\" spacing=\"0\" style=\"margin-left: 2px; line-height: 60% ;\">";
while ($rowbis = mysql_fetch_array($resultbis))
{
echo "<tr><td><font style=\"color: black; font-size:90%;\">» ".$rowbis['titre']."</font></td></tr>";
}
echo "</table>";
}
echo "</td>";
echo "</tr>";
$the_day++;
}
}
elseif ($the_day > $total_days) {
$the_day = " ";
echo "<td valign=\"top\" bgcolor=\"#DFDFDF\"></td>";
echo "</tr>";
}
elseif ($the_day != " ") {
if ($the_day == date(j) and $this_month == date("n") and $this_year == date("Y"))
{
echo "<td valign=\"top\" class=\"kaltexr\" onclick=\"window.location.href='jour.php?jour=$the_day&mois=$this_month&annee=$this_year'\" onMouseOver=\"this.style.backgroundColor='#FEFFBF';\" onMouseOut=\"this.style.backgroundColor='#FEFF97'\" bgcolor=#FEFF97><b>$the_day</b><br>";
}
else
{
echo "<td valign=\"top\" class=\"kaltexr\" onclick=\"window.location.href='jour.php?jour=$the_day&mois=$this_month&annee=$this_year'\" onMouseOver=\"this.style.backgroundColor='#E9ECEF';\" onMouseOut=\"this.style.backgroundColor='#C3C3C3'\" bgcolor=#C3C3C3><b>$the_day</b><br>";
}
$querytris="SELECT titre FROM agenda WHERE date='$the_day/$this_month/$this_year' and genre='jour férié' ORDER BY id";
$resulttris=mysql_query($querytris) or die(mysql_error());
if (mysql_num_rows($resulttris) >= 1)
{
echo "<font style=\"color:#404040; font-size:90%;\"><center><b>";
while ($rowtris = mysql_fetch_array($resulttris))
{
echo "".$rowtris['titre']."";
}
echo "</b></center></font><br>";
}
$queryquattro="SELECT titre FROM agenda WHERE date='$the_day/$this_month' and genre='jour férié' ORDER BY id";
$resultquattro=mysql_query($queryquattro) or die(mysql_error());
if (mysql_num_rows($resultquattro) >= 1)
{
echo "<font style=\"color:#404040;font-size:90%;\"><center><b>";
while ($rowquattro = mysql_fetch_array($resultquattro))
{
echo "".$rowquattro['titre']."";
}
echo "</b></center></font><br>";
}
$query="SELECT login FROM members WHERE annif='$the_day/$this_month' ORDER BY id";
$result=mysql_query($query) or die(mysql_error());
if (mysql_num_rows($result) >= 1)
{
echo "<font style=\"sidered\" style=\"font-size:90%;\">Verjaardag:</font>";
echo "<br><table padding=\"0\" spacing=\"0\" style=\"margin-left: 2px; line-height: 60% ;\">";
while ($row = mysql_fetch_array($result))
{
echo "<tr><td><font style=\"color: black; font-size:90%;\">» ".$row['login']."</font></td></tr>";
}
echo "</table>";
}
$querybis="SELECT titre FROM agenda WHERE date='$the_day/$this_month/$this_year' and genre='activité' ORDER BY id";
$resultbis=mysql_query($querybis) or die(mysql_error());
if (mysql_num_rows($resultbis) >= 1)
{
echo "<font style=\"sidered\" style=\"font-size:90%;\">Activiteiten:</font>";
echo "<br><table padding=\"0\" spacing=\"0\" style=\"margin-left: 2px; line-height: 60% ;\">";
while ($rowbis = mysql_fetch_array($resultbis))
{
echo "<tr><td><font style=\"color: black; font-size:90%;\">» ".$rowbis['titre']."</font></td></tr>";
}
echo "</table>";
}
echo "</td>";
echo "</tr>";
$the_day++;
}
else {
$the_day = " ";
echo "<td valign=\"top\" bgcolor=\"#DFDFDF\"></td>";
echo "</tr>";
}
$week_num++;
}
echo "</table>";
echo "</td></tr>";
echo "</table>";
?>
<br>
</center>
</body>
</html>[/code]
----------- jour.php -----------
[code]<?php
header("Cache-Control: no-cache, must-revalidate, no-store\nPragma: no-cache\n");
?>
<HTML>
<HEAD>
<TITLE>Agenda</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body,td,p,select,input,textarea {
color: #333333;
font-size: 11px;
font-family: Verdana, Arial, Helvetica, sans-serif;
margin:0,0,0,0;
}
a{
color: #333333;
font-size: 11px;
font-family: Verdana, Arial, Helvetica, sans-serif;
text-decoration:underline;
}
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
color: #0D4E95;
font-weight: bold;
padding-bottom:0px;
padding-top:0px;
}
a.topnav {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
color: #333333;
font-weight: bold;
text-decoration:none;
}
a.topnav:hover {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
color: #333333;
font-weight: bold;
text-decoration:underline;
}
.sidered {color: #0D4E95; font-size: 11px; font-family: Verdana, Arial, Helvetica, sans-serif;}
.side {color: #333333; font-size: 11px; font-family: Verdana, Arial, Helvetica, sans-serif;}
a.sideredlinks{color: #0D4E95; font-size: 11px; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold;text-decoration:underline; }
h1 {
font-size: 18px;
color: #0D4E95;
}
.base {font-size: 10px;margin-left:28px;}
td.kalalg { padding: 0px; margin: 0px; center: top; font: 11px Verdana, Arial; font-weight: bold; background-color: #FFFFFF; color: #0000CC; line-height: 16px; }
td.kaltit { padding: 0px; margin: 0px; center: top; font: 11px Verdana, Arial; font-weight: normal; background-color: #FFFFFF; color: #AAAAAA; border-bottom: solid 1px #AAAAAA;}
td.kaltexr { width: 117px; padding: 0px; height: 100px; cursor: hand; margin: 0px; font: 11px Verdana, Arial; font-weight: normal; color: #0D4E95; }
-->
</style>
</HEAD>
<body>
<center>
<?php
$jour = $_GET['jour'];
$mois = $_GET['mois'];
$annee = $_GET['annee'];
$jds = date("w", mktime(0, 0, 0, $mois, $jour, $annee));
$arrayjour = array(
"Zondag",
"Maandag",
"Dinsdag",
"Woensdag",
"Donderdag",
"Vrijdag",
"Zaterdag"
);
$jour_nom = $arrayjour[$jds];
$arraymois = array(
"januari",
"februari",
"maart",
"april",
"mei",
"juni",
"juli",
"augustus",
"september",
"oktober",
"november",
"december"
);
$mois_nom = $arraymois[$mois-1];
// Mysql connectie
$user = "user";
$dbpass = "pass";
$host = "localhost";
$dbdb = "database";
if (!mysql_select_db($dbdb, mysql_connect($host, $user, $dbpass)))
{
echo "Verbinding met de database mislukt.";
exit();
}
?>
<h1>Agenda</h1><br>
<center><table width="350" height="350"><tr><td height="15" style="padding: 0px; margin: 0px; font: 14px Verdana, Arial; font-weight: normal; background-color: #FFFFFF; color: #AAAAAA; border: solid 1px #AAAAAA;">
<?php
echo "<center>$jour_nom $jour $mois_nom $annee</center>";
?>
</td></tr>
<tr><td bgcolor="#CDD2D9" valign="top" style="padding: 5px; border: solid 1px #AAAAAA;">
<?php
$querytris="SELECT titre FROM agenda WHERE date='$jour/$mois/$annee' and genre='jour férié' ORDER BY id";
$resulttris=mysql_query($querytris) or die(mysql_error());
if (mysql_num_rows($resulttris) >= 1)
{
echo "<font style=\"color:#404040;\"><center><b>";
while ($rowtris = mysql_fetch_array($resulttris))
{
echo "".$rowtris['titre']."";
}
echo "</b></center></font><br>";
}
$queryquattro="SELECT titre FROM agenda WHERE date='$jour/$mois' and genre='jour férié' ORDER BY id";
$resultquattro=mysql_query($queryquattro) or die(mysql_error());
if (mysql_num_rows($resultquattro) >= 1)
{
echo "<font style=\"color:#404040;\"><center><b>";
while ($rowquattro = mysql_fetch_array($resultquattro))
{
echo "".$rowquattro['titre']."";
}
echo "</b></center></font><br>";
}
$query="SELECT login,nom,prenom,email,section FROM members WHERE annif='$jour/$mois' ORDER BY id";
$result=mysql_query($query) or die(mysql_error());
if (mysql_num_rows($result) >= 1)
{
echo "<font class=\"sidered\"><b>Verjaardag:</b></font><br>";
while ($row = mysql_fetch_array($result))
{
echo "<table><tr><td style=\"padding-left: 15px;\">";
echo "<font class=\"sidered\">» Verjaardag van ".$row['login']."</font><br>";
echo "<table><tr><td style=\"padding-left: 15px;\">".$row['prenom']." ".$row['nom']."<br>";
echo "Afdeling: ".$row['section']."<br>";
echo "Email: ".$row['email']."</td></tr></table></td></tr></table>";
}
echo "<br>";
}
echo "<font class=\"sidered\"><b>Activiteiten:</b></font><br>";
$querybis="SELECT titre,details FROM agenda WHERE date='$jour/$mois/$annee' and genre='activité' ORDER BY id";
$resultbis=mysql_query($querybis) or die(mysql_error());
if (mysql_num_rows($resultbis) >= 1)
{
while ($rowbis = mysql_fetch_array($resultbis))
{
echo "<table><tr><td style=\"padding-left: 15px;\">";
echo "<font class=\"sidered\">» ".$rowbis['titre']."</font><br>";
echo "<table><tr><td style=\"padding-left: 15px;\">".$rowbis['details']."";
echo "</td></tr></table></td></tr></table>";
}
echo "<br>";
}
else
{
echo "<table><tr><td style=\"padding-left: 15px;\">";
echo "Geen activiteiten<br></td></tr></table>";
}
?>
</td></tr></table>
</center><br><br><br>
<font style="color:#0D4E95; font-family: Verdana, Arial, Helvetica, sans-serif;"><b>
Een activiteit toevoegen:
</b></font>
<form action="<?php echo "activok.php?jour=$jour&mois=$mois&annee=$annee"; ?>" method="post">
<table>
<tr>
<td valign="top">Date:</td>
<td><?php echo "$jour_nom $jour $mois_nom $annee"; ?></td>
<tr>
<tr>
<td valign="top">Titel:</td>
<td><input type="text" maxlength="40" name="titre" style="width:320px;background-color:#D0D0D0; border:1px solid;"></td>
<tr>
<td valign="top">Details :</td>
<td><TEXTAREA name="details" cols="50" rows="10" style="background-color:#D0D0D0; border:1px solid;"></textarea><br><br><center><input type="submit" name="envoyer" value="Envoyer" style="border:1px solid;"> <input type="reset" value="Effacer" style="border:1px solid;"></center></td>
</tr></table>
</center>
</form>
</center>
</body>
</html>[/code]
----------- activok.php -----------
[code]<HTML>
<HEAD>
<TITLE>Agenda</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body,td,p,select,input,textarea {
color: #333333;
font-size: 11px;
font-family: Verdana, Arial, Helvetica, sans-serif;
margin:0,0,0,0;
}
a{
color: #333333;
font-size: 11px;
font-family: Verdana, Arial, Helvetica, sans-serif;
text-decoration:underline;
}
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
color: #0D4E95;
font-weight: bold;
padding-bottom:0px;
padding-top:0px;
}
a.topnav {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
color: #333333;
font-weight: bold;
text-decoration:none;
}
a.topnav:hover {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
color: #333333;
font-weight: bold;
text-decoration:underline;
}
.sidered {color: #0D4E95; font-size: 11px; font-family: Verdana, Arial, Helvetica, sans-serif;}
.side {color: #333333; font-size: 11px; font-family: Verdana, Arial, Helvetica, sans-serif;}
a.sideredlinks{color: #0D4E95; font-size: 11px; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold;text-decoration:underline; }
h1 {
font-size: 18px;
color: #0D4E95;
}
.base {font-size: 10px;margin-left:28px;}
td.kalalg { padding: 0px; margin: 0px; center: top; font: 11px Verdana, Arial; font-weight: bold; background-color: #FFFFFF; color: #0000CC; line-height: 16px; }
td.kaltit { padding: 0px; margin: 0px; center: top; font: 11px Verdana, Arial; font-weight: normal; background-color: #FFFFFF; color: #AAAAAA; border-bottom: solid 1px #AAAAAA;}
td.kaltexr { width: 117px; padding: 0px; height: 100px; cursor: hand; margin: 0px; font: 11px Verdana, Arial; font-weight: normal; color: #0D4E95; }
-->
</style>
</HEAD>
<body>
<center>
<?php
// mysql connectie
$user = "user";
$dbpass = "pass";
$host = "localhost";
$dbdb = "database";
if (!mysql_select_db($dbdb, mysql_connect($host, $user, $dbpass)))
{
echo "Verbinding met de database mislukt.";
exit();
}
if ($_POST['titre'])
{
$titre = addslashes($_POST['titre']);
$details = addslashes($_POST['details']);
$details = nl2br($details);
$jour = $_GET['jour'];
$mois = $_GET['mois'];
$annee = $_GET['annee'];
$sql = "INSERT INTO agenda SET id = '', titre = '$titre', details = '$details', date = '$jour/$mois/$annee', genre = 'activité'";
mysql_query($sql) or die (mysql_error());
?>
<h1>Activiteit toegevoegd</h1>
Uw activiteit werd succesvol toegevoegd! U kan het resultaat <a href="javascript: history.go(-1)">hier</a> zien.
<?php
}
else
{
echo "<h1>Error</h1>\n";
echo "Vul alle velden in aub.<br>\n";
echo "<br><br><input type=\"button\" value=\"Herbeginnen\" onclick=\"javascript:history.back()\" style=\"border:1px solid;\">\n";
}
?>
</center>
</form>
</center>
</body>
</html>[/code]
Reacties
0