<html>
<head>
</head>
<body>
<center>
<?php
if ( !isset($_COOKIE['login'])){ header("location: ?p=aanmelden");} if ($actie == "opstellen")
{
?>
<form method="post">
<table border="0" width="50%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">
<table border="1" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="8%">Onderwerp</td>
<td width="92%"><input type="text" name="onderwerp"></td>
</tr>
<tr>
<td width="8%">Bericht</td>
<td width="92%" rowspan="3"><textarea name="bericht" rows=3 cols=20 wrap="on"></textarea></td>
</tr>
<tr>
<td width="8%"> </td>
</tr>
<tr>
<td width="8%"> </td>
</tr>
<tr>
<td width="100%" colspan="2">
<p align="center"><input type="submit" name="Verstuur" value="Verstuur"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<?
if(!empty($_POST['Verstuur'])){ $datum = date("d/m/Y h:i");
if($_POST["onderwerp"] != "" && $_POST["bericht"] != "")
{
mysql_query("insert into forum (onderwerp,van,datum,bericht) values ('".$_POST["onderwerp"]."','".$_COOKIE["login"]."','".$datum."','".$_POST["bericht"]."')") or
die(mysql_error()); echo "Bericht verstuurd";
}
else
{
echo "U moet alles wel goed invullen"; }
}
}
elseif ($actie == "bekijk")
{
$query4 = mysql_query("select * FROM forum WHERE id='".$_GET["id"]."' ORDER BY datum DESC"); $query2 = mysql_query("select * FROM forumreacties WHERE forumid='".$_GET["forumid"]."' ORDER BY datum DESC");
?>
<table border="0" width="70%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">
<table border="1" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="8%">Door</td>
<td width="92%">
<? echo $row4->van; ?></td>
</tr>
<tr>
<td width="8%">Onderwerp</td>
<td width="92%">
<? echo $row4->onderwerp; ?></td>
</tr>
<tr>
<td width="8%">Bericht</td>
<td width="92%" valign="top" rowspan="3"><?$row4->bericht; ?></td>
</tr>
<tr>
<td width="8%"> </td>
</tr>
<tr>
<td width="8%"> </td>
</tr>
<br><br><br>
<tr>
<td width="8%"> </td>
<td width="92%"><b>Reacties:</b></td>
</tr>
<tr>
<td width="8%"> </td>
<td width="92%"> </td>
<tr>
<td width="8%">Door</td>
<td width="92%">
<? echo $row2->van; ?></td>
</tr>
<tr>
<td width="8%">Datum</td>
<td width="92%">
<? echo $row2->datum; ?></td>
</tr>
<tr>
<td width="8%">Reactie</td>
<td width="92%">
<? echo $row2->bericht; ?></td>
</tr>
<tr>
<td width="8%"> </td>
<td width="92%"> </td>
</tr>
<?
}
?>
<tr>
<td width="8%"> </td>
<td width="92%"><b>Plaats een reactie<b></td>
</tr>
<form method="post">
<tr>
<td width="8%">Bericht</td>
<td width="92%" rowspan="3"><textarea name="bericht" rows=3 cols=20 wrap="on"></textarea></td>
</tr>
<tr>
<td width="8%"> </td>
</tr>
<tr>
<td width="8%"> </td>
</tr>
<tr>
<td width="100%" colspan="2">
<p align="center"><input type="submit" name="reageer" value="reageer"></td>
</tr>
</table>
</td>
</tr>
</form>
<?
}
if(!empty($_POST['reageer'])){ $datum = date("d/m/Y h:i");
if($_POST["bericht"] != "")
{
mysql_query("insert INTO forumreacties (forumid,van,bericht,datum) values('".$_GET["forumid"]."','".$_COOKIE["login"]."','".$_POST[bericht
]."','".$datum."')") or
die(mysql_error()); echo "Reactie verzonden"; }
else
{
echo "U moet wel alles goed invullen!"; }
}
elseif ($actie == "")
{
?>
<p align="left"><a href="?p=forum&actie=opstellen">Bericht toevoegen</a></p>
<table border="0" width="70%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">
<table border="1" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="2%"> </td>
<td width="25%"><b>Onderwerp</b></td>
<td width="26%"><b>Van</b></td>
<td width="2%"> </td>
</tr>
<?
$query = mysql_query("select * from forum order BY datum DESC"); ?>
<tr>
<td width="2%"> </td>
<td width="25%"><a href="?p=forum&actie=bekijk&forumid=
<? echo $row->id; ?>&id=
<? echo $row->id;?
>">
<?
echo $row->onderwerp; ?></a></td>
<td width="26%">
<? echo $row->van; ?></td>
<td width="2%"> </td>
</tr>
<?
}
}
?>
</body>
</html>