<?php
#######################################################|#
#|                    HabboMCMS - TheRox
#|                    Powered by HoloCMS 
#|            Copyright 2011-2012 ALL RIGHTS RESERVED
#######################################################|#


require_once('../global.php');
if($hkzone !== true){ header("Location: index.php?throwBack=true"); exit; }
if(!session_is_registered(acp)){ header("Location: index.php?p=login"); exit; }

$pagename = "Liste de bans";

$do = Filter($_GET['do']);

$date_ac = time();
$date_calcul = $date * 3600;
$date_ban = $date_ac + $date_calcul;

	if($do == "ban-") {
		
	if(isset($pseudo) && isset($raison)) {
		if(!empty($pseudo) && !empty($raison) && !empty($date)) {
	
	for($n = 0; $n < $nbr; $n++):
		$sql = mysql_query("SELECT id FROM users WHERE username = '".$name[$n]."'");
		$row = mysql_num_rows($sql);
		if($row > 0) {
				//mysql_query("INSERT INTO cms_stafflog (pseudo,action,date) VALUES ('".$user['username']."','Banissement de: ".$name[$n]." pour raison: ".$raison."','".FullDate('full')."')");
				//mysql_query("INSERT INTO bans (bantype,value,reason,expire,added_by,added_date,appeal_state) VALUES ('user','".$name[$n]."','".$raison."','".$date_ban."','".$myrow['username']."','".FullDate('full')."','0')") or die(mysql_error());
					$msg = "&nbsp; Le compte <b>".$name[$n]."</b> &agrave; &eacute;t&eacute; bannis pour la raison suivante: <b>".$raison."</b>";
					} else {
					$msg = "&nbsp; Le compte <b>".$name[$n]."</b> n\'existe pas.";
					}	
					endfor;
					} else {
					$msg = "&nbsp; Les champs ne sont pas tous remplie.";
					}
			} 
	}
        

@include('subheader.php');
@include('header.php');
?>
<table cellpadding='0' cellspacing='8' width='100%' id='tablewrap'>
<tr> <td width='22%' valign='top' id='leftblock'>
 <div>
 <!-- LEFT CONTEXT SENSITIVE MENU -->
<?php @include('usermenu.php'); ?>
 <!-- / LEFT CONTEXT SENSITIVE MENU -->
 </div>
 </td>
 <td width='78%' valign='top' id='rightblock'>
 <div><!-- RIGHT CONTENT BLOCK -->

    

<div class='tableborder'>
    <?php
        $sql = mysql_query("SELECT * FROM bans LIMIT 200");
        $row = mysql_num_rows($sql);
    //
    ?>
<div class='tableheaderalt'>Liste des Habbos bannis (<u><?php echo $row; ?></u>)</div>

<table width='100%' cellspacing='0' cellpadding='5' align='center' border='0'>


    <tr style="font-weight: bold;">
    <td>Pseudo</td>
    <td>Type</td>
    <td>Raison</td>
    <td>Bannir par</td>
    <td>Expiration</td>
    
</tr>

 <?php    
    while($banned = mysql_fetch_assoc($sql)) { ?>
<tr>
    <td><?php echo $banned['value']; ?></td>
    <td><?php echo $banned['bantype']; ?></td>
    <td><?php echo charset_decode_utf_8($banned['reason']); ?></td>
    <td><?php echo $banned['added_by']; ?></td>
    <td><?php echo $banned['expire']; ?></td>
</tr>

<?php } ?>


</table></div><br />	 </div><!-- / RIGHT CONTENT BLOCK -->
	 </td></tr>
</table>
</div><!-- / OUTERDIV -->
<div align='center'><br />
<?php
$mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime;
printf('Time: %.3f', $totaltime);
?>
</div>