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

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

$dbres	=	mysql_query("SELECT * FROM `spel_statestieken` WHERE `id`='1'");
$link	=	mysql_fetch_object($dbres);

$dbres1		=	mysql_query("SELECT * FROM `gebruiker` WHERE `level`='2'");
$rows1		=	mysql_num_rows($dbres1);
$dbres2		=	mysql_query("SELECT * FROM `gebruiker` WHERE `level`='-2'");
$rows2		=	mysql_num_rows($dbres2);
$dbres3		=	mysql_query("SELECT * FROM `gebruiker`");
$rows3		=	mysql_num_rows($dbres3);
$dbres4		=	mysql_query("SELECT * FROM `gebruiker` WHERE UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(`online`) < 86400");
$rows4		=	mysql_num_rows($dbres4);
$dbres5		=	mysql_query("SELECT * FROM `gebruiker` WHERE `level`='-1'");
$rows5		=	mysql_num_rows($dbres5);
$dbres1		=	mysql_query("SELECT * FROM `gebruiker` WHERE `sex`='Man'");
$rows6		=	mysql_num_rows($dbres1);
$spelers	=	$rows3;
$levend		=	$spelers-$rows2;
$levendp	=	round((100/$spelers)*$levend);
$man		=	$rows6;
$manp		=	round((100/$spelers)*$man);
$vrouw		=	$spelers-$rows6;
$vrouwp		=	round((100/$spelers)*$vrouw);
$dood		=	$rows2;
$doodp		=	round((100/$spelers)*$dood);
$ban		=	$rows5;
$banp		=	round((100/$spelers)*$ban);
$online		=	$rows4;
$onlinep	=	round((100/$spelers)*$online);
$betalend	=	$rows1;
$betalendp	=	round((100/$spelers)*$betalend);
$dbres		=	mysql_query("SELECT * FROM `betalingen` WHERE `soort`='Bellen'");
$betaal1	=	mysql_num_rows($dbres);
$dbres		=	mysql_query("SELECT * FROM `betalingen` WHERE `soort`='Ideal'");
$betaal2	=	mysql_num_rows($dbres);

?>

<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" colspan="2">
		<b>Click statestieken</b>
		</td>
	</tr>
	<tr>
		<td width="600" class="mainTxt" align="center">
		<table width="70%" cellpadding="0" cellspacing="0">
			<tr>
				<td width="80%">
				Members :<br>
				</td>
				<td width="10%">
				<?php echo $spelers; ?>
				</td>
				<td width="10%">
				(100%)<br>
				</td>
			</tr>
			<tr>
				<td width="80%">
				Betalend :<br>
				</td>
				<td width="10%">
				<?php echo $betalend; ?>
				</td>
				<td width="10%">
				(<?php echo $betalendp; ?>%)<br>
				</td>
			</tr>
			<tr>
				<td width="80%">
				Levend :<br>
				</td>
				<td width="10%">
				<?php echo $levend; ?>
				</td>
				<td width="10%">
				(<?php echo $levendp; ?>%)<br>
				</td>
			</tr>
			<tr>
				<td width="80%">
				Vandaag online :<br>
				</td>
				<td width="10%">
				<?php echo $online; ?>
				</td>
				<td width="10%">
				(<?php echo $onlinep; ?>%)<br>
				</td>
			</tr>
			<tr>
				<td width="80%">
				Dood :<br>
				</td>
				<td width="10%">
				<?php echo $dood; ?>
				</td>
				<td width="10%">
				(<?php echo $doodp; ?>%)<br>
				</td>
			</tr>
			<tr>
				<td width="80%">
				Verbannen :<br>
				</td>
				<td width="10%">
				<?php echo $ban; ?>
				</td>
				<td width="10%">
				(<?php echo $banp; ?>%)<br>
				</td>
			</tr>
			<tr>
				<td width="80%">
				Mannen :<br>
				</td>
				<td width="10%">
				<?php echo $man; ?>
				</td>
				<td width="10%">
				(<?php echo $manp; ?>%)<br>
				</td>
			</tr>
			<tr>
				<td width="80%">
				Vrouwen :<br>
				</td>
				<td width="10%">
				<?php echo $vrouw; ?>
				</td>
				<td width="10%">
				(<?php echo $vrouwp; ?>%)<br>
				</td>
			</tr>
			<tr>
				<td width="80%">			
				<a href="http://www.top100nl.net" target="_NEW">http://www.top100nl.net</a> : <br>
				</td>
				<td width="20%" colspan="2">
				<?php echo $link->link1; ?><br>
				</td>
			</tr>
			<tr>
				<td width="80%">
				<a href="http://www.gametop.nl" target="_NEW">http://www.gametop.nl</a> : <br>
				</td>
				<td width="20%" colspan="2">
				<?php echo $link->link2; ?><br>
				</td>
			</tr>
			<tr>
				<td width="80%">
				<a href="http://www.dutchleader.nl" target="_NEW">http://www.dutchleader.nl</a> : <br>
				</td>
				<td width="20%" colspan="2">
				<?php echo $link->link3; ?><br>
				</td>
			</tr>
			<tr>
				<td width="80%">
				<a href="http://www.3dee.nl/topsites" target="_NEW">http://www.3dee.nl/topsites</a> : <br>
				</td>
				<td width="20%" colspan="2">
				<?php echo $link->link4; ?><br>
				</td>
			</tr>
			<tr>
				<td width="80%">
				Micropayments (IVR / 0909) : <br>
				</td>
				<td width="20%" colspan="2">
				<?php echo $betaal1; ?><br>
				</td>
			</tr>
			<tr>
				<td width="80%">
				Ideal : <br>
				</td>
				<td width="20%" colspan="2">
				<?php echo $betaal2; ?><br>
				</td>
			</tr>
		</table>
		</td>
	</tr>
</table>
<br>
<table align="center" width="600">
	<tr>
		<td class="subTitle" colspan="2">
		<b>Extra paneel</b>
		</td>
	</tr>
	<tr>
		<td width="600" class="mainTxt" align="center">

<?php

	if(isset($_POST['submit4'])){

	} else if(isset($_POST['submit5'])){
		if($_POST['type3'] == 1){
		mysql_query("INSERT INTO `admin`(`login`,`level`) VALUES('{$_POST['login']}','3')");
		mysql_query("UPDATE `gebruiker` SET `level`='3',`memberdays`='00-00-0000 00:00:00' WHERE `login`='{$_POST['login']}'");
		echo "Je hebt {$_POST['login']} als admin benoemt.";
		} else if($_POST['type3'] == 2){
		mysql_query("INSERT INTO `admin`(`login`,`level`) VALUES('{$_POST['login']}','2')");
		mysql_query("UPDATE `gebruiker` SET `level`='3',`memberdays`='00-00-0000 00:00:00' WHERE `login`='{$_POST['login']}'");
		echo "Je hebt {$_POST['login']} als hulp admin benoemt.";
		} else if($_POST['type3'] == 3){
		mysql_query("INSERT INTO `admin`(`login`,`level`) VALUES('{$_POST['login']}','1')");
		mysql_query("UPDATE `gebruiker` SET `level`='3',`memberdays`='00-00-0000 00:00:00' WHERE `login`='{$_POST['login']}'");
		echo "Je hebt {$_POST['login']} als moderator benoemt.";
		} else if($_POST['type3'] == 4){
		mysql_query("DELETE FROM `admin` WHERE `login`='{$_POST['login']}'");
		mysql_query("UPDATE `gebruiker` SET `level`='2',`dagen`=`dagen`+'21',`memberdays`=NOW() WHERE `login`='{$_POST['login']}'");
		echo "Je hebt {$_POST['login']} als betalend lid benoemt.";
		} else if($_POST['type3'] == 5){
		mysql_query("DELETE FROM `admin` WHERE `login`='{$_POST['login']}'");
		mysql_query("UPDATE `gebruiker` SET `level`='1',`memberdays`='00-00-0000 00:00:00' WHERE `login`='{$_POST['login']}'");
		echo "Je hebt {$_POST['login']} als normaal lid benoemt.";
		}
	} else if(isset($_POST['submit6'])){

	} else {

?>

		<form method="post">
		<table width="70%">
			<tr>
				<td width="50%">
				Login:
				</td>
				<td width="50%">
				<input type="text" value="<?php echo $_GET['login']; ?>" name="login" style="width:150" maxlenght="16">
				</td>
			</tr>
			<tr>
				<td width="50%">
				Killen:
				</td>
				<td width="50%">
				<select name="type2" style="width:150">
				<option value="1">Killen</option>
				<option value="0">Unkillen</option>
				</select>
				</td>
			</tr>
			<tr>
				<td width="50%">
				</td>
				<td width="50%">
				<input type="submit" name="submit4" value="Submit" style="width:150">
				</td>
			</tr>
			<tr>
				<td width="50%">
				&nbsp;
				</td>
				<td width="50%">
				&nbsp;
				</td>
			</tr>
			<tr>
				<td width="50%">
				Promoten:
				</td>
				<td width="50%">
				<select name="type3" style="width:150">
				<option value="1">Admin</option>
				<option value="2">Hulp admin</option>
				<option value="3">Moderator</option>
				<option value="4">Betalend</option>
				<option value="5">Normaal</option>
				</select>
				</td>
			</tr>
			<tr>
				<td width="50%">
				</td>
				<td width="50%">
				<input type="submit" name="submit5" value="Submit" style="width:150">
				</td>
			</tr>
			<tr>
				<td width="50%">
				&nbsp;
				</td>
				<td width="50%">
				&nbsp;
				</td>
			</tr>
			<tr>
				<td width="50%">
				Verwijderen:
				</td>
				<td width="50%">
				<select name="type4" style="width:150">
				<option value="1">Verwijder</option>
				<option value="2">Reset</option>
				</select>
				</td>
			</tr>
			<tr>
				<td width="50%">
				</td>
				<td width="50%">
				<input type="submit" name="submit6" value="Submit" style="width:150">
				</td>
			</tr>
		</table>
		</form>

<?php

	}

?>

		</td>
	</tr>
</table>
<form method="post">
<table align="center" width="600">
	<tr>
		<td class="subTitle" colspan="2">Admin - IP bannen</td>
	</tr>
	<tr>
		<td width="600" class="mainTxt" align="center">
		<table width="70%" align="center">
			<tr>
				<td width="50%">
				Login:
				</td>
				<td width="50%">
				<input type="text" name="login" maxlenght="16">
				</td>
			</tr>
			<tr>
				<td width="50%">
				&nbsp;
				</td>
				<td width="50%">
				<input type="submit" value="IP bannen" name="submit1">
				</td>
			</tr>
		</table>
		</td>
	</tr>

<?php

	if(isset($_POST['submit1'])){
	$dbres	=	mysql_query("SELECT * FROM `gebruiker` WHERE `login`='{$_POST['login']}' AND `level`!='0' AND `level`!='-2'");
		if($user = mysql_fetch_object($dbres)){
		mysql_query("INSERT INTO `ipban`(`ip`,`login`) VALUES('{$user->ip}','{$user->login}')");
		echo "<tr><td width=\"600\" class=\"mainTxt\" align=\"center\" colspan=\"2\">Je hebt {$user->login}'s ip gebanned.</td></tr>";
		}
	} else if($_GET['actie'] == "deletea"){
	mysql_query("DELETE FROM `ipban` WHERE `id`='{$_GET['id']}'");
	echo "<tr><td width=\"600\" class=\"mainTxt\" align=\"center\" colspan=\"2\">IP ban verwijdert.</td></tr>";
	}
?>

	<tr>
		<td class="subtitle" colspan="2">&nbsp;</td>
	</tr>
</table>
</form>
<table align="center" width="600">
	<tr>
		<td class="subTitle" colspan="2">
		<b>Verbannen leden</b>
		</td>
	</tr>
	<tr>
		<td>
		<table width=100%>
			<tr>
				<td class="subTitle" style="letter-spacing: normal;" align="center" width=45%>
				<b>Crimineel</b>
				</td>
				<td class="subTitle" style="letter-spacing: normal;" align="center" width=45%>
				<b>Ip</b>
				</td>
				<td class="subTitle" style="letter-spacing: normal;" align="center" width=10%>
				<b>Delete</b>
				</td>
			</tr>

<?php

$dbres		=	mysql_query("SELECT * FROM `ipban`");
	while($user = mysql_fetch_object($dbres)){
?>

			<tr onMouseOver="this.style.backgroundColor='#6F5E4A';" onMouseOut="this.style.backgroundColor='#4B3D32';" style="background-color: #4B3D32;">
				<td align="center" class="justborderS" width="45%"><a href="speler-profiel.php?x=<?php echo $user->login; ?>"><?php echo $user->login; ?></a></td>
				<td align="center" class="justborderS" width="45%"><?php echo $user->ip; ?></td>
				<td align="center" class="justborderS" width="10%"><a href="admin-paneel.php?actie=deletea&id=<?php echo $user->id; ?>"><img src="layout/images/icons/light_delete.jpg" border=0 width="16" height="16"></a></td>
			</tr>

<?php

	}

?>

		</table>
		</td>
	</tr>
</table>
<form method="post">
<table align="center" width="600">
	<tr>
		<td class="subTitle" colspan="2">Admin - Spel bannen</td>
	</tr>
	<tr>
		<td width="600" class="mainTxt" align="center">
		<table width="70%" align="center">
			<tr>
				<td width="50%">
				Login:
				</td>
				<td width="50%">
				<input type="text" name="login" maxlenght="16">
				</td>
			</tr>
			<tr>
				<td width="50%">
				&nbsp;
				</td>
				<td width="50%">
				<input type="submit" value="bannen" name="submit2">
				</td>
			</tr>
		</table>
		</td>
	</tr>

<?php

	if(isset($_POST['submit2'])){
	$dbres	=	mysql_query("SELECT * FROM `gebruiker` WHERE `login`='{$_POST['login']}' AND `level`!='0' AND `level`!='-2'");
		if($user = mysql_fetch_object($dbres)){
		mysql_query("UPDATE `gebruiker` SET `level`='-1' WHERE `login`='{$_POST['login']}'");
		echo "<tr><td width=\"600\" class=\"mainTxt\" align=\"center\" colspan=\"2\">Je hebt {$user->login} verbanned.</td></tr>";
		}
	} else if($_GET['actie'] == "deleteb"){
	mysql_query("UPDATE `gebruiker` SET `level`='1' WHERE `login`='{$_GET['login']}'");
	echo "<tr><td width=\"600\" class=\"mainTxt\" align=\"center\" colspan=\"2\">{$_GET['login']} ban verwijdert.</td></tr>";
	}
?>

	<tr>
		<td class="subtitle" colspan="2">&nbsp;</td>
	</tr>
</table>
</form>
<table align="center" width="600">
	<tr>
		<td class="subTitle" colspan="2">
		<b>Verbannen leden</b>
		</td>
	</tr>
	<tr>
		<td>
		<table width=100%>
			<tr>
				<td class="subTitle" style="letter-spacing: normal;" align="center" width=45%>
				<b>Crimineel</b>
				</td>
				<td class="subTitle" style="letter-spacing: normal;" align="center" width=45%>
				<b>Online</b>
				</td>
				<td class="subTitle" style="letter-spacing: normal;" align="center" width=10%>
				<b>Delete</b>
				</td>
			</tr>

<?php

$dbres		=	mysql_query("SELECT * FROM `gebruiker` WHERE `level`='-1'");
	while($user = mysql_fetch_object($dbres)){
?>

			<tr onMouseOver="this.style.backgroundColor='#6F5E4A';" onMouseOut="this.style.backgroundColor='#4B3D32';" style="background-color: #4B3D32;">
				<td align="center" class="justborderS" width="45%"><a href="speler-profiel.php?x=<?php echo $user->login; ?>"><?php echo $user->login; ?></a></td>
				<td align="center" class="justborderS" width="45%"><?php echo $user->online; ?></td>
				<td align="center" class="justborderS" width="10%"><a href="admin-paneel.php?actie=deleteb&login=<?php echo $user->login; ?>"><img src="layout/images/icons/light_delete.jpg" border=0 width="16" height="16"></a></td>
			</tr>

<?php

	}

?>

		</table>
		</td>
	</tr>
</table>
</body>
</html>