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

<html lang="nl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Ultimatecrime - Forum - <?php $forum->name?></title>
<meta name="description" content="Ultimatecrime Forum - Nieuws - Lees over de laatste ontwikkelingen!">
<meta name="keywords" content="world, gangster, crimineel, maffia, games, game, multiplayer, mmorpg, rpg, gratis">
<meta name="Robots" CONTENT="follow">
<meta name="REVISIT-AFTER" CONTENT="15 days">
<link rel="stylesheet" type="text/css" href="style_general.css">
</head>
<body background="layout/images/layout_12.gif" bgproperties="fixed">
<br>
<br>
<br>
<table width="600" align="center">
	<tr>
  		<td class="subtitle" colspan="2">
		Ultimatecrime Forum - <?php echo $forum->name;?>
		</td>
	</tr>

<?php

	if($_GET['actie'] == "normal"){

	mysql_query("UPDATE `topic` SET `soort`='1' WHERE `id`='{$_GET['id']}'");

	} else if($_GET['actie'] == "sticky"){

	mysql_query("UPDATE `topic` SET `soort`='3' WHERE `id`='{$_GET['id']}'");

	} else if($_GET['actie'] == "important"){

	mysql_query("UPDATE `topic` SET `soort`='2' WHERE `id`='{$_GET['id']}'");

	} else if($_GET['actie'] == "delete"){

	mysql_query("DELETE FROM `topic` WHERE `id`='{$_GET['id']}'");
	mysql_query("DELETE FROM `topic_replay` WHERE `topic_id`='{$_GET['id']}'");

	}
?>
	<tr>
		<td class="maintxt" colspan="2">
		<table width="580" border="0" align="center" cellpadding="0" cellspacing="0">

<?php

$begin	=	($_GET['p'] >= 0) ? $_GET['p']*30 : 0;




$dbres1	=	mysql_query("SELECT * FROM `topic` WHERE `forum_id`='{$_GET['x']}' AND `soort`='3' ORDER BY `replays` DESC LIMIT $begin,10");
	while($topic = mysql_fetch_object($dbres1)){

		if($data->level == 3){
		$menu	=	"<a href=\"forum-board.php?actie=normal&id={$topic->id}&x={$_GET['x']}\"><img src=\"layout/images/icons/light_comment.jpg\" border=0 width=\"16\" height=\"16\"></a> <a href=\"forum-board.php?actie=sticky&id={$topic->id}&x={$_GET['x']}\"><img src=\"layout/images/forum/icon_thread_star.jpg\" border=0 width=\"16\" height=\"16\"></a> <a href=\"forum-board.php?actie=important&id={$topic->id}&x={$_GET['x']}\"><img src=\"layout/images/forum/icon_lock.jpg\" border=0 width=\"16\" height=\"16\"></a> <a href=\"forum-newtopic.php?actie=edit&id={$topic->id}&x={$_GET['x']}\"><img src=\"layout/images/forum/icon_forum.jpg\" border=0 width=\"16\" height=\"16\"></a> <a href=\"forum-board.php?actie=delete&id={$topic->id}&x={$_GET['x']}\"><img src=\"layout/images/icons/light_delete.jpg\" border=0 width=\"16\" height=\"16\"></a>";
		} else {
		$menu	=	"";
		}

		if($topic->login == $data->login && $menu == ""){
		$menu	=	"<a href=\"forum-newtopic.php?actie=edit&id={$topic->id}&x={$_GET['x']}\"><img src=\"layout/images/forum/icon_forum.jpg\" border=0 width=\"16\" height=\"16\"></a> <a href=\"forum-board.php?actie=delete&id={$topic->id}&x={$_GET['x']}\"><img src=\"layout/images/icons/light_delete.jpg\" border=0 width=\"16\" height=\"16\"></a>";
		}

?>

			<tr>
				<td width="20"><img src="layout/images/forum/icon_thread_star.jpg" width="16" height="16"></td>
				<td width="275"><a href="forum-topic.php?x=<?php echo $topic->id; ?>&id=<?php echo $_GET['x']; ?>" class="forumlink"><?php echo $topic->titel; ?></a></td>
				<td width="40" align="right" class="forum_subtitle"><?php echo $topic->replays; ?></td>
				<td width="20">&nbsp;</td>
				<td width="20"><img src="layout/images/forum/icon_man.jpg" width="16" height="16"></td>
				<td width="145"><a href="speler-profiel.php?x=<?php echo $topic->login; ?>" class="forumlink"><?php echo $topic->login; ?></a></td>
				<td width="120" align="right"><?php echo $menu; ?></td>
			</tr>
					
<?php

	$menu == "";

	}


$dbres2	=	mysql_query("SELECT * FROM `topic` WHERE `forum_id`='{$_GET['x']}' AND `soort`='1' ORDER BY `replays` DESC LIMIT $begin,10");

	while($topic = mysql_fetch_object($dbres2)){

		if($data->level == 3){
		$menu	=	"<a href=\"forum-board.php?actie=normal&id={$topic->id}&x={$_GET['x']}\"><img src=\"layout/images/icons/light_comment.jpg\" border=0 width=\"16\" height=\"16\"></a> <a href=\"forum-board.php?actie=sticky&id={$topic->id}&x={$_GET['x']}\"><img src=\"layout/images/forum/icon_thread_star.jpg\" border=0 width=\"16\" height=\"16\"></a> <a href=\"forum-board.php?actie=important&id={$topic->id}&x={$_GET['x']}\"><img src=\"layout/images/forum/icon_lock.jpg\" border=0 width=\"16\" height=\"16\"></a> <a href=\"forum-newtopic.php?actie=edit&id={$topic->id}&x={$_GET['x']}\"><img src=\"layout/images/forum/icon_forum.jpg\" border=0 width=\"16\" height=\"16\"></a> <a href=\"forum-board.php?actie=delete&id={$topic->id}&x={$_GET['x']}\"><img src=\"layout/images/icons/light_delete.jpg\" border=0 width=\"16\" height=\"16\"></a>";
		} else {
		$menu	=	"";
		}

		if($topic->login == $data->login && $menu == ""){
		$menu	=	"<a href=\"forum-newtopic.php?actie=edit&id={$topic->id}&x={$_GET['x']}\"><img src=\"layout/images/forum/icon_forum.jpg\" border=0 width=\"16\" height=\"16\"></a> <a href=\"forum-board.php?actie=delete&id={$topic->id}&x={$_GET['x']}\"><img src=\"layout/images/icons/light_delete.jpg\" border=0 width=\"16\" height=\"16\"></a>";
		}

?>

			<tr>
				<td width="20"><img src="layout/images/forum/icon_thread.jpg" width="16" height="16"></td>
				<td width="275"><a href="forum-topic.php?x=<?php echo $topic->id; ?>&id=<?php echo $_GET['x']; ?>" class="forumlink"><?php echo $topic->titel; ?></a></td>
				<td width="40" align="right" class="forum_subtitle"><?php echo $topic->replays; ?></td>
				<td width="20">&nbsp;</td>
				<td width="20"><img src="layout/images/forum/icon_man.jpg" width="16" height="16"></td>
				<td width="145"><a href="speler-profiel.php?x=<?php echo $topic->login; ?>" class="forumlink"><?php echo $topic->login; ?></a></td>
				<td width="120" align="right"><?php echo $menu; ?></td>
			</tr>

<?php

	$menu == "";

	}


$dbres3	=	mysql_query("SELECT * FROM `topic` WHERE `forum_id`='{$_GET['x']}' AND `soort`='2' ORDER BY `replays` DESC LIMIT $begin,10");

	while($topic = mysql_fetch_object($dbres3)){

		if($data->level == 3){
		$menu	=	"<a href=\"forum-board.php?actie=normal&id={$topic->id}&x={$_GET['x']}\"><img src=\"layout/images/icons/light_comment.jpg\" border=0 width=\"16\" height=\"16\"></a> <a href=\"forum-board.php?actie=sticky&id={$topic->id}&x={$_GET['x']}\"><img src=\"layout/images/forum/icon_thread_star.jpg\" border=0 width=\"16\" height=\"16\"></a> <a href=\"forum-board.php?actie=important&id={$topic->id}&x={$_GET['x']}\"><img src=\"layout/images/forum/icon_lock.jpg\" border=0 width=\"16\" height=\"16\"></a> <a href=\"forum-newtopic.php?actie=edit&id={$topic->id}&x={$_GET['x']}\"><img src=\"layout/images/forum/icon_forum.jpg\" border=0 width=\"16\" height=\"16\"></a> <a href=\"forum-board.php?actie=delete&id={$topic->id}&x={$_GET['x']}\"><img src=\"layout/images/icons/light_delete.jpg\" border=0 width=\"16\" height=\"16\"></a>";
		} else {
		$menu	=	"";
		}

		if($topic->login == $data->login && $menu == ""){
		$menu	=	"<a href=\"forum-newtopic.php?actie=edit&id={$topic->id}&x={$_GET['x']}\"><img src=\"layout/images/forum/icon_forum.jpg\" border=0 width=\"16\" height=\"16\"></a> <a href=\"forum-board.php?actie=delete&id={$topic->id}&x={$_GET['x']}\"><img src=\"layout/images/icons/light_delete.jpg\" border=0 width=\"16\" height=\"16\"></a>";
		}

?>

			<tr>
				<td width="20"><img src="layout/images/forum/icon_lock.jpg" width="16" height="16"></td>
				<td width="275"><a href="forum-topic.php?x=<?php echo $topic->id; ?>&id=<?php echo $_GET['x']; ?>" class="forumlink"><?php echo $topic->titel; ?></a></td>
				<td width="40" align="right" class="forum_subtitle"><?php echo $topic->replays; ?></td>
				<td width="20">&nbsp;</td>
				<td width="20"><img src="layout/images/forum/icon_man.jpg" width="16" height="16"></td>
				<td width="145"><a href="speler-profiel.php?x=<?php echo $topic->login; ?>" class="forumlink"><?php echo $topic->login; ?></a></td>
				<td width="120" align="right"><?php echo $menu; ?></td>
			</tr>
	


<?php

	$menu == "";

	}

?>

		</table>
		</td>
	<tr>

<?php

$dbres	=	mysql_query("SELECT * FROM `topic` WHERE `forum_id`='{$_GET['x']}'");

	if(mysql_num_rows($dbres) > 10){
	echo "<td class=\"maintxt\" align=\"center\" colspan=\"2\">";


		if($begina/10 == 0){
		echo "<<</font>";
		} else {
		echo "<a href=\"forum-board.php?x={$_GET['x']}&p=". ($begina/10-1) ."\"><<</a>";
		}

		for($i=0; $i<mysql_num_rows($dbres)/10; $i++){
		echo " <a href=\"forum-board.php?x={$_GET['x']}&p=$i\">". ($i+1) ."</a> ";
		}

		if($begina+10 >= mysql_num_rows($dbres)) {
		echo ">>";
		} else {
		echo "<a href=\"forum-board.php?x={$_GET['x']}&p=". ($begina/10+1) ."\">>></a>";
		}



	echo "&nbsp; </td></tr><tr>";
	}

?>

	</tr>
	<tr>
		<td class="subtitle" colspan="2">&nbsp;</td>
	</tr>
	<tr>

<?php

	if(! check_login()){

?>

	<tr>
		<td class="mainTxt" width="600" colspan="2" align="center"><span class="header_rood">Je bent niet ingelogd en kunt dus niet participeren!</span></td>
	</tr>
	<tr>
		<td class="subtitle" colspan="2">&nbsp;</td>
	</tr>
</table>

<?php

	} else {

		if($data->level == 3 OR $forum->admin == 0){

?>
							<tr>
		<td class="mainTxt" width="300" align="center">
		<table>
			<tr>
				<td><img src="layout/images/forum/icon_newtopic.jpg"></td>
				<td><a href="forum-newtopic.php?y=<?php echo $forum->id; ?>"><strong>Nieuw onderwerp</strong></a></td>
			</tr>
		</table>
		</td>
		<td class="mainTxt" width="300" align="center">
		<table>
			<tr>
				<td><img src="layout/images/forum/icon_back.jpg"></td>
				<td><a href="internet-forum.php"><strong>Terug naar forum overzicht</strong></a></td>
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td class="subtitle" colspan="2">&nbsp;</td>
	</tr>
</table>

<?php

		} else {

?>

	<tr>
		<td class="mainTxt" width="600" align="center">
		<table>
			<tr>
				<td><img src="layout/images/forum/icon_back.jpg"></td>
				<td><a href="internet-forum.php"><strong>Terug naar forum overzicht</strong></a></td>
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td class="subtitle" colspan="2">&nbsp;</td>
	</tr>
</table>

<?php

		}
	}

?>

</body>
</html>

