<?php
if (!isset($_SESSION))
{
	session_start();
}
require_once ('header.php');
if ($aangemeld == "ja")
{
?>
<link rel="stylesheet" href="style/forum.css" type="text/css" media="all">
<style type="text/css">
	
.titlemedium
{
	background-image: url(img/forum/tile_sub.gif) 
}
.maintitle
{
	background-image: url(img/forum/tile_back.gif) 
}
</style>

<br />

<table width="525" border="0" cellspacing="0" cellpadding="0" align="center" class='forum'>
<tr>
<td colspan="3">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td width="77"><img src="img/forum/topleft.gif" alt="" /></td>
<td width="100%"  background="img/forum/topbg.gif"><center><b>Forum</b></center></td>
<td width="503" align="right"><img src="img/forum/topright.gif" alt="" /></td>
</tr>
</table>
</td></tr>
<tr>
<td width="10" valign="top" background="img/forum/leftbg.gif"><img src="img/forum/leftbg.gif" alt="" /></td>
<td align="left" valign="top" bgcolor="#c5bdbb" width="100%">
<table cellpadding="0" cellspacing="0" border="0" width="100%" bgcolor="#c5bdbb" align="center">
<tr>
<td class="post1">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>

<td width="100%" background="img/forum/logobg.gif"><div align="center" class="copyright"></div></td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td width="29"><img src="img/forum/membarleft.gif" width="29" height="38" alt="" /></td>
<td width="100%" background="img/forum/membarbg.gif"><table width='100%' cellpadding='0' cellspacing='0' border='0' align='center'>
<tr>
<td align='left' class='memberbar' valign='middle' style='padding: 0px 0px 4px 0px;'><strong>Welkom <?php echo $_SESSION['naam']; ?></strong></td>
<td align='right' class='memberbar' valign='middle' style='padding: 0px 0px 4px 0px;'><?php echo $_SESSION['member_posts']; ?> posts</td></tr></table></td>
<td width="21" align="right"><img src="img/forum/membarright.gif" width="21" height="38" alt="" /></td>
</tr>
</table>
<div align="right"><a href="topics.php"><img src="img/forum/t_topic.gif"></a></a></div>

<div class="tableborder" style="display:show" id="fo_130">
	<table cellspacing="0" cellpadding="2" width="100%">
        <tr> 
          <th align="center" width="2%" nowrap="nowrap" class='titlemedium'><img src="img/forum/spacer.gif" alt="" width="26" height="1" /></th>
          <th align="left" width="43%" nowrap="nowrap" class='titlemedium'>Nieuw topic</th>
         
        </tr>
<tr><th colspan="2" class="post2">
<?php
if (($member_status == "manager") or ($member_status == "staff"))
{
	$toon = "ja";
}
else
{
	$toon = "nee";
}
if (ISSET($_POST['submit']) && ISSET($_POST['na_am']) && ISSET($_POST['script1']) && ISSET($_POST['tit_el']) && ($_POST['tit_el'] != "") && ($_POST['tit_el'] != " ") && ($_POST['script1'] != "") && ($_POST['script1'] != " "))
{
	if (ISSET($_POST['rechten']))
	{
		if ($_POST['rechten'] == true)
		{
			$rechten = "staff";
		}
		else
		{
			$rechten = "all";
		}
	}
	else
	{
		$rechten = "all";
	}
	$datum = date("d.m.Y H:i");
	if (($_POST['tit_el'] != "") and ($_POST['tit_el'] != " "))
	{
		mysql_query("INSERT INTO topics SET titel = '".$_POST['tit_el']."', bericht = '".$_POST['script1']."', datum = '".$datum."', naam = '".$_POST['na_am']."', actief = '".$datum."', rechten = '".$rechten."';");
		$posts_nu = halen("SELECT posts FROM members WHERE naam='".$_SESSION['naam']."'");
		$posts_nu++;
		mysql_query("UPDATE members SET posts = '".$posts_nu."' WHERE naam='".$_SESSION['naam']."';");
		$_SESSION['member_posts'] = $posts_nu;
	}
	echo "Even geduld a.u.b...";
	action("maakt het topic '".$_POST['tit_el']."'");
	$hoedat = "stuurdoor";
}
elseif (ISSET($_POST['submit']) || ISSET($_POST['na_am']) || ISSET($_POST['script1']) || ISSET($_POST['tit_el']))
{
	echo "<font size='3'>Niet alle velden zijn ingevult!</font>";
}
if (ISSET($hoedat))
{
	echo "<meta http-equiv=\"refresh\" content=\"0;url=topics.php\">";
}
else
{
	echo '
     <br>
   <table border="0" cellspacing="0" cellpadding="0" width="490">
<tr><td>

<table class="bigborder" cellspacing="0" cellpadding="0" bordercolor="#102750" width="490"><tr><td>
<table border="0" cellspacing="0" cellpadding="8">
<tr><td colspan="2"><center><script language="JavaScript1.2" type="text/javascript" src="javascript/ubbc.js"></script>
';
	require('knoppen.php');
	echo '
<br><script language="JavaScript1.2" type="text/javascript" src="javascript/smileys.js"></script></center></td></tr>
<form method="POST" action="' . $PHP_SELF . '" name="formulier">
<input type="hidden" name="na_am" size="40" value="'.$_SESSION['naam'].'">
<tr><td width="120" valign="top"><b><small>Onderwerp</small></b></td>
<td valign="top"><input type="text" name="tit_el" size="40" value="">';
if ($toon == "ja")
{
	echo '<input type="checkbox" name="rechten"> SiteStaff topic';
}
echo '</td></tr>
<tr><td width="120" valign="top"><b><small>Bericht</small></b></td>
<td valign="top"><textarea name="script1" rows="10" cols="50"></textarea></td></tr>
<tr><td width="120" valign="top">&nbsp;</td><td><input type="submit" name="submit" value="Topic aanmaken"></td></tr>
</form></table></td></tr></table></td></tr></table> ';
}
echo "<br>\n";
?>
</th></tr></table>
</div>
<table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="#e0d6d6">
<tr>
<td width="22"><img src="img/forum/catleft.gif" width="22" height="24" alt="" /></td>
<td width="100%" background="img/forum/catbg.gif"></td>
<td width="22" align="right"><img src="img/forum/catright.gif" width="22" height="24" alt="" /></td>
</tr>
</table>
</td></tr>
</table></td>
<td width="9" background="img/forum/rightbg.gif"><img src="img/forum/rightbg.gif" alt="" /></td>
</tr>
<tr>
<td valign="middle" align="right" width="100%" colspan="3">
<table cellpadding="0" border="0" cellspacing="0" width="100%">
<tr>
<td width="12"><img src="img/forum/botleft.gif" width="12" height="14" alt="" /></td>
<td width="100%" background="img/forum/botbg.gif"></td>
<td width="10"><img src="img/forum/botright.gif" width="10" height="14" alt="" /></td>
</tr>
</table>
<table cellpadding="0" border="0" cellspacing="0" width="100%">
<tr>
<td width="46"><img src="img/forum/bottomleft.gif" alt="" /></td>
<td width="100%" background="img/forum/bottombg.gif"><!-- Copyright Information -->
<div align='center' class='copyright'></div></td>
<td width="46"><map name="topmap" id="topmap"><area shape="rect" coords="21,13,40,26" alt="Top" href="javascript:scroll(0,0);" /></map>
<img src="img/forum/bottomright.gif" width="46" height="29" alt="" border="0" usemap="#topmap" /></td>
</tr>
</table>
</td></tr>
</table>
<?php
}
else
{
	echo "<h1>Forum</h1>";
	echo "Oeps! Hiervoor moet je aangemeld zijn!";
}
require_once ('footer.php');
?>