<?php
ob_start();
include("config.php");
	if(! check_login()) { 
	exit;
	}

	if($data->level != 3){
	exit;
	}

?>

<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>
<form method="post">
<table align="center" width="600">
	<tr>
		<td class="subTitle" colspan="3">
		<b>Admin forum</b>
		</td>
	</tr>

<?php

	if(isset($_POST['submit'])){
	$dbres	=	mysql_query("SELECT * FROM `topic_replay` WHERE `login`='{$_POST['login']}'");
		while($topic = mysql_fetch_object($dbres)){
		mysql_query("DELETE FROM `topic_replay` WHERE `id`='{$topic->id}'");
		mysql_query("UPDATE FROM `topic` SET `replays`=`replays`-'1' WHERE `id`='{$topic->topic_id}'");
		}

	mysql_query("DELETE FROM `topic` WHERE `login`='{$_POST['login']}'");

	echo "<tr><td class=\"Maintxt\" align=\"center\" width=\"600\">Je hebt {$_POST['login']}'s zijn forum posts verwijdert.</td></tr>";
	} else {


?>


	<tr>
		<td class="Maintxt" align="center" width="150"><input type="text" name="login" width="50" maxlength="16"></td>
		<td class="Maintxt" align="center" width="300">Verwijder al zijn forum posts</td>
		<td class="Maintxt" align="center" width="150"><input name="submit" type="submit" value="Verwijder posts" width="100"></td>
	</tr>
</table>
</form>

<?php

	}

?>

</table>
</body>
</html>