<? include('checkcookie.php'); ?>
<h3>Список забаненных пользователей</h3>
<br>
<?
if (isset($_GET["id"]))
{
	$id=$_GET["id"];
	$option=$_GET["option"];

	if ($option=="delete")
	{
		$user=$_POST["user"];
		$queryz = "DELETE FROM tb_chatban WHERE id='$id'";
		mysql_query($queryz) or die(mysql_error());
		echo "<font color=\"#dd0000\"><b>Бан с пользователя $user снят.</b></font><br><br>";
	}
}
?>

<table cellspacing="0" cellpadding="0">
<tr align="center">
<th>Имя пользователя</th>
<th>Причина бана</th>
<th>&nbsp;</th>
</tr>
<?
$res = mysql_query("SELECT * FROM tb_chatban ORDER BY id ASC");
while ($row = mysql_fetch_array($res)) { 

echo "
<tr align=\"center\">
<td>". $row["user"] ."</td>
<td>". $row["reason"] ."</td>
<td>";
?>
<form method="post" action="adminmain.php?p=chatban&id=<?=$row["id"] ?>&option=delete">
<input type="hidden" value="<?=$row["user"] ?>" name="user">
<input type="submit" value="Снять бан" class="button">
</form>
</td>
</tr>

<?

}

?>
</table>