<?php

$Num_Forum = $forum_id;
if ($Num_Forum <= 0)
{
	$Num_Forum = $num;
}

if (isset($modif_blacklist))
{

	switch($submit)
	{
		case "Autoriser":
			$sSQL="Delete from blacklist WHERE PlayerName='".$PlayerName."' AND ForumId='".$Num_Forum."'";
			$q->query($DB, $sSQL);
			echo "<div class=stdDark ><font color=#087508>Autorisation du joueur ".$PlayerName." effectuée</font></div>";
			break;
		case "Interdire":
			$sSQL="Select * from blacklist";
			$sSQL.=" where ForumId='".$Num_Forum."' AND PlayerName='".$PlayerName."'";
			$q->query($DB, $sSQL);
			$rec=(object)$q->getrow();
			
			if (isset($rec->Id))
			{
				echo "<div class=stdDark><font color=#FF0000>Le joueur ".$PlayerName." est déjà interdit</font></div>";
			}
			else
			{
				$sSQL="REPLACE INTO blacklist (PlayerName, ForumId) VALUES ('".$PlayerName."', '".$Num_Forum."')";
				echo "Rq : "."REPLACE INTO blacklist (PlayerName, ForumId) VALUES ('".$PlayerName."', '".$Num_Forum."')";
				$q->query($DB, $sSQL);
				echo "<div class=stdDark><font color=#FF0000>Interdication du joueur ".$PlayerName." effectuée</font></div>";
			}
			break;
	}
}
?>

<form>
<input type=hidden name="page" value="<?php echo $page?>">
<input type=hidden name="modif_blacklist" value="1">
<input type=hidden name="num" value="<?php echo $num/*$forum_id*/?>">
Nom du joueur :  <input type="text" size=10 name="PlayerName" value="<?php echo $PlayerName?>">
<br><br>
<input type=submit name=submit value="Interdire">&nbsp;&nbsp;&nbsp;
<input type=submit name=submit value="Autoriser">&nbsp;&nbsp;&nbsp;<br>
</form>

<br>
<div class=stdDark>LA LISTE DES JOUEURS INTERDITS SUR CE FORUM</div>
<br>

<table border=1 cellpadding=3 cellspacing=0>
<tr>
<td bgcolor=#FFFFFF class=bolDark>Pseudo</td></tr>

<?php



$sSQL="Select * from blacklist";
if($forum!='all') $sSQL.=" where ForumId='".$Num_Forum."' ORDER BY PlayerName ASC";
$q->query($DB, $sSQL);
$rec=(object)$q->getrow();

While(isset($rec->Id))
{
  echo "<tr><td class=stdDark>".$rec->PlayerName."</td></tr>";
  $rec=(object)$q->getrow();
}

?>
</table>
 