<?PHP
#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|
#|                                                                        #|
#|         JabboCMS - Website and Content Management System               #|
#|         Copyright © 2011 Jor.dan. All rights reserved.                 #|
#|																		  #|
#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|

include("../global.php");

	if(!session_is_registered(username))
	{
		Redirect("".$url."/index.php");
		exit();
	}
	
	if($user['rank'] < 4) {
	Redirect("".$url."/index.php");
	exit();
	}

	
$pseudo = Securise($_POST['name']);
$name = explode(";", $pseudo);
$nbr = count($name);


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

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

	if($do == "ban") {
		
	if(isset($pseudo)) {
		if(!empty($pseudo)) {
	
	for($n = 0; $n < $nbr; $n++):
		$sql = mysql_query("SELECT id FROM users WHERE username = '".$name[$n]."'");
		$row = mysql_num_rows($sql);
		if($row < 1) {
				echo '<div id="pasok">&nbsp; Le compte <b>'.$name[$n].'</b> n\'existe pas.</div><br>';
				
				} else {
				$check = mysql_query("SELECT * FROM bans WHERE value = '".$name[$n]."'");
				$row_c = mysql_num_rows($check);
				if($row_c > 0) {
				mysql_query("INSERT INTO cms_stafflog (pseudo,action,date) VALUES ('".$user['username']."','Debanissement de: ".$name[$n]."','".FullDate('full')."')");
				mysql_query("DELETE FROM bans WHERE value = '".$name[$n]."'") or die(mysql_error());
				echo '<div id="ok">&nbsp; Le compte <b>'.$name[$n].'</b> &agrave; &eacute;t&eacute; d&eacute;bannis.</div><br>';					
					} else {
					echo '<div id="pasok">&nbsp; Le compte <b>'.$name[$n].'</b> n\'est pas bannis.</div></br>';
					}
				}
	endfor;
									 } else {
					echo '<div id="pasok">&nbsp; Les champs ne sont pas tous remplie.</div>';
					}
			} 
	}
?>
	
<link href="./template/style.css" rel="stylesheet" type="text/css"><body> 
<p><span class="HEADLINE">D&eacute;bannir des utilisateurs en mass.</span><br />
Ici vous pourriez d&eacute;bannir plusieurs utilisateurs en m&ecirc;me temps pour cela apr&egrave;s chaque pseudo mettez un point virgule (;).<br><br>
<form name='editor' method='post' action="?do=ban">
<td width='100' class='tbl'><b>Pseudo:</b><br></td>
<td width='80%' class='tbl'><textarea name='name' wrap=discuss rows=3 cols=34 ></textarea><br></td>
<br>
<tr>
<td align='center' colspan='2' class='tbl'>
<input type='submit' name='submit' value='Ex&eacute;cuter' class='submit'></form>
</tr>
</body>
</html>

</tr>