<?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']);
$raison = Securise($_POST['reason']);
$date = Securise($_POST['date']);
$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) && 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."','".$user['username']."','".FullDate('full')."','0')") or die(mysql_error());
				echo '<div id="ok">&nbsp; Le compte <b>'.$name[$n].'</b> &agrave; &eacute;t&eacute; bannis pour la raison suivante: <b>'.$raison.'</b></div><br>';
					} else {
					echo '<div id="pasok">&nbsp; Le compte <b>'.$name[$n].'</b> n\'existe pas.</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">Bannir des utilisateurs en mass.</span><br />
Ici vous pourriez 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><td width='100' class='tbl'><b>Raison:</b><br></td>
<td width='80%' class='tbl'><textarea name='reason' wrap=discuss rows=3 cols=34 ></textarea><br></td><br>
<td width='80%' class='tbl'><select name="date" id="lenght" class="select"><option value="1">1 Heures</option><option value="2">2 Heures</option><option value="3">3 Heures</option><option value="4">4 Heures</option><option value="5">5 Heures</option><option value="6">6 Heures</option><option value="7">7 Heures</option><option value="8">8 Heures</option><option value="9">9 Heures</option><option value="10">10 Heures</option><option value="11">11 Heures</option><option value="12">12 Heures</option><option value="13">13 Heures</option><option value="14">14 Heures</option><option value="15">15 Heures</option><option value="16">16 Heures</option><option value="17">17 Heures</option><option value="18">18 Heures</option><option value="19">19 Heures</option><option value="20">20 Heures</option><option value="21">21 Heures</option><option value="22">22 Heures</option><option value="23">23 Heures</option><option value="24">24 Heures</option><option value="100008">4167 Jours</option></select>
<tr>
<td align='center' colspan='2' class='tbl'>
<input type='submit' name='submit' value='Ex&eacute;cuter' class='submit'></form>
</tr>
</body>
</html>

</tr>