<?php
include("config.php3");
include($BIB."bib_generic.php3");
include($BIB."bib_tables.php3");

$sess = open_page($sessid, 1);
//if ($sess->memberid == -1) $sess->reinit("Error: invalid access to bet page");
if ($sess->memberid == -1) $sess->redirect($REGISTRATION_PAGE, "");

$member = getmember($sess->memberid);
$player = getplayer($sess->memberid);

$title = C_PARISTITLE;

if($deblock==1)
{
	//echo "daim mother fucker !!!";
	$squery = "SELECT Players.Id AS Id, NickName FROM Players".
		" LEFT JOIN Messagerie_BlackList ON Messagerie_BlackList.Black = Players.Id". 
		" WHERE Messagerie_BlackList.Blacker=".$player['Id'];
	$rowsBlacks = main_db_query($squery);
	//debug("1 - ".$squery);
	while( $rowBlack = db_fetch_assoc($rowsBlacks) )
	{
		//debug("2 - ".$rowBlack['NickName']);
		if( $$rowBlack['Id']==1)
		{
			$squery = "SELECT Messagerie_BlackList.Id FROM Messagerie_BlackList".
				" LEFT JOIN Players ON Players.Id = Messagerie_BlackList.Black".
				" WHERE Players.NickName = '".$rowBlack['NickName']."'".
				" AND Messagerie_BlackList.Blacker=".$player['Id'];
			
			$rowsBlacksLists = main_db_query($squery);
			$rowBlackList = db_fetch_assoc($rowsBlacksLists);
			
			$squeryDelete = "DELETE FROM Messagerie_BlackList WHERE Id=".$rowBlackList['Id'];
	
			//debug($squeryDelete);			
			$rowsBlackDelete = main_db_query($squeryDelete);
			
		}
		
	}
	
}

?>
<html>
<head>
<title><?php echo $GAME_NAME ?></title>
<META CONTENT="kestufoot, kestufoot.com, football, sport, pronostics sportifs, parier, mise, jeux, pronostics, matchs, championnat de France, équipes, L1" NAME="Keywords">
<link rel="stylesheet" href="<?php echo $SERVER_URL?>common.css">
<link rel="stylesheet" href="<?php echo $SERVER_URL?>links.css">
<link rel="stylesheet" href="<?php echo $SERVER_URL?>tables.css">
</head>
<body LEFTMARGIN="0" TOPMARGIN="0" rightmargin=0 bottommargin=0 bgcolor=white>

<?php  
$squery = "SELECT Players.Id AS Id, NickName FROM Players".
		" LEFT JOIN Messagerie_BlackList ON Messagerie_BlackList.Black = Players.Id". 
		" WHERE Messagerie_BlackList.Blacker=".$player['Id'];
		
$rowsBlacksLists = main_db_query($squery);
$r = 1;
# recup les NickName de chaque joueur de PlayerOptions
while($tmp_row = db_fetch_assoc($rowsBlacksLists))
{
	$var_id = "Id".$r;
	$var_name = "Name".$r;
	//$tmp_row = db_fetch_assoc($rowsBlacksLists);
	//$name = $tmp_row["NickName"];
	$$var_name = $tmp_row["NickName"];
	$$var_id = $tmp_row['Id'];

	$r++;
}

?>
<br style=font-size:1px>
<center>
<?php 
include("form_header.inc"); 
table_ktf_up("<h1 class='h1table'>Ma blackliste</h1>", "100%", 'green',1,'','','#FFFFFF' ); 

?>
<table cellpadding=5 align=center width=450>
<tr>
	<td class=smallDark align=left colspan=3>
	Pour autoriser à nouveau  un joueur « black listé », cochez celui que vous voulez débloquer et cliquez sur « débloquer »

	</td>
</tr>
<?php 
$index_case = 0;
for ($ligne = 1 ; $ligne <= 10 ; $ligne++)
{
	echo "<tr bgcolor=#EAEAEA>";
	for ($colonne = 1 ; $colonne <= 3 ; $colonne++)
	{
		$index_case++;
		$var_id = "Id".$index_case;
		$var_name = "Name".$index_case;
		
		if($$var_id != "")
		{
			?>
			<td width=10%  class=smallDark align=left>
			<input type=checkbox name="<?php echo $$var_id;?>" value="1">
			<?php echo $$var_name ?>
			</td>
<?php
		}
	}
	echo "</tr>";
}
?>
</table>
<div align=right>
<input type="image" name="Valider" src="<?php echo $IMAGES_DIR . "boutons/btn_debloquer.gif"?>" border="0" alt="Valider">
<input type="hidden" name="deblock" value="1">
</div>
<?php 
include("form_footer.inc");  
table_ktf_down("",1);
 ?>
<div class=std align=right><img src="<?php echo $IMAGES_DIR?>triangleorange.gif" border=0> <a class=smallDarkLink href="javascript:window.close()">Fermer la popup</a><font size=1>&nbsp;&nbsp;</font></div>
</body>
</html>

