<?PHP
include "config.php";
if ($ingelogd == "0"){
echo "<meta http-equiv=\"refresh\" content=\"0;URL=login.php\">";
exit;
}
include('header.php');
?>

<html>
<head>
<title>Ultimatecrime</title>
<link rel="stylesheet" type="text/css" href="style_general.css">
</head>
<body background="layout/images/layout_12.gif" bgproperties="fixed">
<br>
<br>
<br>
<table align="center" width="600">
	<tr>
		<td class="subTitle">
		<b>Forum onderwerp aanpassen</b>
		</td>
	</tr>
	<tr>
		<td width="600" class="mainTxt" align="center">
		Je moet 30 seconden wachten voordat je weer wat kunt posten op het forum!
		</td>
	</tr>
<table>
</body>
</html>

<html>
<head>
<title>Ultimatecrime</title>
<link rel="stylesheet" type="text/css" href="style_general.css">
</head>
<body background="layout/images/layout_12.gif" bgproperties="fixed">
<br>
<br>
<br>

<?php

	if($_GET['actie'] == "edit" || isset($_POST['submit1'])){
	$dbres	=	mysql_query("SELECT * FROM `topic` WHERE `id`='{$_GET['id']}'");
	$topic	=	mysql_fetch_object($dbres);
		if($data->level == 3){
		} else if($topic->login == $data->login){
		} else {
		exit;
		}

?>

<form name="form1" method="POST" action="forum-newtopic.php?action=edit">
<table align="center" width="600">
	<tr>
		<td class="subTitle" colspan="2">
		<b>Forum onderwerp aanpassen</b>
		</td>
	</tr>

<?php

		if(isset($_POST['submit1'])){
			if(isset($_POST['subject']) && isset($_POST['message'])){
				if(trim($_POST['subject']) && trim($_POST['message'])){
				$_POST['subject']	=	htmlspecialchars($_POST['subject']);
				$title			=	preg_replace('/\</','&#60;',substr($_POST['subject'],0,28));
				$_POST['message']	=	htmlspecialchars($_POST['message']);
				$message		=	preg_replace('/\</','&#60;',substr($_POST['message'],0,6000));
				mysql_query("UPDATE `topic` SET `titel`='$title',`message`='{$message}' WHERE `id`='{$_POST['x']}'");
				echo "<tr><td width=600 class=\"mainTxt\" align=\"center\">Je hebt het bericht aangepast.</td></tr>";
				exit;
				}
			}
		}

?>

	<tr>
		<td width="300" class="mainTxt"><span class="tekstheader">Onderwerp titel</span><br>Geef een duidelijke titel op!<br><br><span class="tekstheader">Goed</span>: geen geld bij SingleJob<br><strong><font color="red">Fout</font></strong>: geld</td>
		<td class="mainTxt" align="center" width="300"><input type="text" name="subject" value="<?php echo $topic->titel; ?>" maxlength=28 size=40></td>
	</tr>
	<tr>
		<td width="600" class="mainTxt" colspan="2"><span class="tekstheader">Bericht</span><br>Type een duidelijk bericht en probeer het netjes te houden!<br><br>
		<textarea name="message" cols="75" rows="20"><?php echo $topic->message; ?></textarea>
		<br><br>
		<a href="javascript://" onClick="document.form1.message.value += ':grin:'"><img src=images/smiles/icon_biggrin.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':S'"><img src=images/smiles/icon_confused.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += '8)'"><img src=images/smiles/icon_cool.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':.('"><img src=images/smiles/icon_cry.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':eek:'"><img src=images/smiles/icon_eek.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':evil:'"><img src=images/smiles/icon_evil.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':lol:'"><img src=images/smiles/icon_lol.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':@'"><img src=images/smiles/icon_mad.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':D'"><img src=images/smiles/icon_mrgreen.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':|'"><img src=images/smiles/icon_neutral.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':P'"><img src=images/smiles/icon_razz.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':$'"><img src=images/smiles/icon_redface.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':roll:'"><img src=images/smiles/icon_rolleyes.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':('"><img src=images/smiles/icon_sad.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':)'"><img src=images/smiles/icon_smile.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':o'"><img src=images/smiles/icon_surprised.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':twisted:'"><img src=images/smiles/icon_twisted.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ';)'"><img src=images/smiles/icon_wink.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':{'"><img src=images/smiles/icon_dracula.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':sick:'"><img src=images/smiles/icon_sick.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':uhm:'"><img src=images/smiles/icon_uhm.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':clap:'"><img src=images/smiles/icon_clap.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':dance:'"><img src=images/smiles/icon_dance.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':stop:'"><img src=images/smiles/icon_stop.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':doh:'"><img src=images/smiles/icon_doh.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':nono:'"><img src=images/smiles/icon_nono.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':think:'"><img src=images/smiles/icon_think.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':ssht:'"><img src=images/smiles/icon_ssht.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':nope:'"><img src=images/smiles/icon_nope.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':salut:'"><img src=images/smiles/icon_salut.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':wall:'"><img src=images/smiles/icon_wall.gif border=0></a>
		</td>
	</tr>
	<tr>
		<td width="600" class="mainTxt" colspan="2" align="center"><input type=hidden name=x value=<?php echo $_GET['id']; ?>><input type="submit" name="submit1" value="Forum onderwerp aanpassen!" style="width: 200;"></td>
	</tr>
</table>

<?php

	} else if($_GET['z'] != ""){

?>

<table align="center" width="600">
	<tr>
		<td class="subTitle" colspan="2">
		<b>Topic post</b>
		</td>
	</tr>

<?php

		if(isset($_POST['submit'])){
		$getal1			=	md5($_SESSION['getal1']);
		$getal2			=	$_GET['code'];
			if($getal1 != "" && $getal1 == $getal2){
				if(isset($_POST['message'])){
					if(trim($_POST['message'])){
					$_POST['message']	=	htmlspecialchars($_POST['message']);
					$message		=	preg_replace('/\</','&#60;',substr($_POST['message'],0,6000));
					mysql_query("UPDATE `gebruiker` SET `posts`=`posts`+'1',`post_time`=NOW() WHERE `login`='{$data->login}'");
					mysql_query("UPDATE `topic` SET `replays`=`replays`+'1' WHERE `id`='{$_GET['z']}'");
					mysql_query("INSERT INTO `topic_replay`(`topic_id`,`login`,`message`,`time`) values('{$_GET['z']}','{$data->login}','$message',NOW())");
					echo "<tr><td width=600 class=\"mainTxt\" align=\"center\">Je hebt een nieuw topic post geplaatst.</td></tr>";
					exit;
					}
				}
			}
		}


	$getal			=	rand(1,10);
	$_SESSION['getal1']	=	$getal;
	$getalb			=	md5($getal); 

?>

<form name="form1" method="POST" action="forum-newtopic.php?code=<?php echo "$getalb"; ?>&z=<?php echo $_GET['z']; ?>">
	<tr>
		<td width="600" class="mainTxt" colspan="2"><span class="tekstheader">Bericht</span><br>Type een duidelijk bericht en probeer het netjes te houden!<br><br>
		<textarea name="message" cols="75" rows="20"><?php echo $topic->message; ?></textarea>
		<br><br>
		<a href="javascript://" onClick="document.form1.message.value += ':grin:'"><img src=images/smiles/icon_biggrin.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':S'"><img src=images/smiles/icon_confused.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += '8)'"><img src=images/smiles/icon_cool.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':.('"><img src=images/smiles/icon_cry.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':eek:'"><img src=images/smiles/icon_eek.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':evil:'"><img src=images/smiles/icon_evil.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':lol:'"><img src=images/smiles/icon_lol.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':@'"><img src=images/smiles/icon_mad.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':D'"><img src=images/smiles/icon_mrgreen.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':|'"><img src=images/smiles/icon_neutral.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':P'"><img src=images/smiles/icon_razz.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':$'"><img src=images/smiles/icon_redface.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':roll:'"><img src=images/smiles/icon_rolleyes.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':('"><img src=images/smiles/icon_sad.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':)'"><img src=images/smiles/icon_smile.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':o'"><img src=images/smiles/icon_surprised.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':twisted:'"><img src=images/smiles/icon_twisted.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ';)'"><img src=images/smiles/icon_wink.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':{'"><img src=images/smiles/icon_dracula.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':sick:'"><img src=images/smiles/icon_sick.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':uhm:'"><img src=images/smiles/icon_uhm.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':clap:'"><img src=images/smiles/icon_clap.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':dance:'"><img src=images/smiles/icon_dance.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':stop:'"><img src=images/smiles/icon_stop.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':doh:'"><img src=images/smiles/icon_doh.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':nono:'"><img src=images/smiles/icon_nono.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':think:'"><img src=images/smiles/icon_think.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':ssht:'"><img src=images/smiles/icon_ssht.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':nope:'"><img src=images/smiles/icon_nope.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':salut:'"><img src=images/smiles/icon_salut.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':wall:'"><img src=images/smiles/icon_wall.gif border=0></a>
		</td>
	</tr>
	<tr>
		<td width="600" class="mainTxt" colspan="2" align="center"><input type="submit" name="submit" value="Forum onderwerp aanpassen!" style="width: 200;"></td>
	</tr>
</table>

<?php

	} else {

?>


<table align="center" width="600">
	<tr>
		<td class="subTitle" colspan="2">
		<b>Nieuwe forum onderwerp</b>
		</td>
	</tr>

<?php

		if(isset($_POST['submit'])){
		$getal1			=	md5($_SESSION['getal2']);
		$getal2			=	$_GET['code'];
			if($getal1 != "" && $getal1 == $getal2){
				if(isset($_POST['subject']) && isset($_POST['message'])){
					if(trim($_POST['subject']) && trim($_POST['message'])){
					$_POST['subject']	=	htmlspecialchars($_POST['subject']);
					$title			=	preg_replace('/\</','&#60;',substr($_POST['subject'],0,28));
					$_POST['message']	=	htmlspecialchars($_POST['message']);
					$message		=	preg_replace('/\</','&#60;',substr($_POST['message'],0,6000));
					mysql_query("UPDATE `gebruiker` SET `posts`=`posts`+'1',`post_time`=NOW() WHERE `login`='{$data->login}'");
					mysql_query("INSERT INTO `topic`(`forum_id`,`login`,`titel`,`message`,`time`) values('{$_POST['x']}','{$data->login}','$title','$message',NOW())");
					echo "<tr><td width=600 class=\"mainTxt\" align=\"center\">Je hebt een nieuw onderwerp geplaatst.</td></tr>";
					exit;
					}
				}
			}
		}

	$getal			=	rand(1,10);
	$_SESSION['getal2']	=	$getal;
	$getalb			=	md5($getal); 

?>

<form name="form1" method="POST" action="forum-newtopic.php?code=<?php echo "$getalb"; ?>">
	<tr>
		<td width="300" class="mainTxt"><span class="tekstheader">Onderwerp titel</span><br>Geef een duidelijke titel op!<br><br><span class="tekstheader">Goed</span>: geen geld bij SingleJob<br><strong><font color="red">Fout</font></strong>: geld</td>
		<td class="mainTxt" align="center" width="300"><input type="text" name="subject" value="" maxlength=28 size=40></td>
	</tr>
	<tr>
		<td width="600" class="mainTxt" colspan="2"><a href="algemeen-help.php?item=forumregels" target="content"><b>Lees de forumregels voordat je iets post!</b></td>
	</tr>
	<tr>
		<td width="600" class="mainTxt" colspan="2"><span class="tekstheader">Bericht</span><br>Type een duidelijk bericht en probeer het netjes te houden!<br><br>
		<textarea name="message" cols="75" rows="20"></textarea>
		<br><br>
		<a href="javascript://" onClick="document.form1.message.value += ':grin:'"><img src=images/smiles/icon_biggrin.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':S'"><img src=images/smiles/icon_confused.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += '8)'"><img src=images/smiles/icon_cool.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':.('"><img src=images/smiles/icon_cry.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':eek:'"><img src=images/smiles/icon_eek.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':evil:'"><img src=images/smiles/icon_evil.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':lol:'"><img src=images/smiles/icon_lol.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':@'"><img src=images/smiles/icon_mad.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':D'"><img src=images/smiles/icon_mrgreen.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':|'"><img src=images/smiles/icon_neutral.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':P'"><img src=images/smiles/icon_razz.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':$'"><img src=images/smiles/icon_redface.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':roll:'"><img src=images/smiles/icon_rolleyes.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':('"><img src=images/smiles/icon_sad.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':)'"><img src=images/smiles/icon_smile.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':o'"><img src=images/smiles/icon_surprised.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':twisted:'"><img src=images/smiles/icon_twisted.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ';)'"><img src=images/smiles/icon_wink.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':{'"><img src=images/smiles/icon_dracula.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':sick:'"><img src=images/smiles/icon_sick.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':uhm:'"><img src=images/smiles/icon_uhm.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':clap:'"><img src=images/smiles/icon_clap.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':dance:'"><img src=images/smiles/icon_dance.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':stop:'"><img src=images/smiles/icon_stop.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':doh:'"><img src=images/smiles/icon_doh.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':nono:'"><img src=images/smiles/icon_nono.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':think:'"><img src=images/smiles/icon_think.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':ssht:'"><img src=images/smiles/icon_ssht.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':nope:'"><img src=images/smiles/icon_nope.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':salut:'"><img src=images/smiles/icon_salut.gif border=0></a>
		<a href="javascript://" onClick="document.form1.message.value += ':wall:'"><img src=images/smiles/icon_wall.gif border=0></a>
		</td>
	</tr>
	<tr>
		<td width="600" class="mainTxt" colspan="2" align="center"><input type=hidden name=x value=<?php echo $_GET['y']; ?>><input type="submit" name="submit" value="Forum onderwerp plaatsen!" style="width: 200;"></td>
	</tr>
</table>

<?php

	}

?>
</form>
</body>
</html>

