Файл: public_html/admin/chatmoders.php
Строк: 46
<? include('checkcookie.php'); ?>
<h3>Настройка модераторов чата</h3>
<br>
<?
if($_POST["action"]!="")
{
$action=$_POST["action"];
$user=$_POST["user"];
if($action=='add')
{
mysql_query("update tb_users set chatmoder='1' where username='$user'");
echo "<font color=#00cc00><b>Пользователь $user назначен модератором чата</b></font>";
}
if($action=='del')
{
mysql_query("update tb_users set chatmoder='0' where username='$user'");
echo "<font color=#cc0000><b>Пользователь $user исключен из списка модераторов чата</b></font>";
}
}
?>
<center>
<table>
<tr><td width=50% align=center>
<form action="" method=post>
<b>Введите имя пользователя:</b><br>
<input type=text value="" size=30 maxlength=25 name="user"><br>
<input type=hidden value="add" name="action">
<input type=submit value="Назначить модератором">
</form>
</td><td width=50% align=center>
<form action="" method=post>
<b>Введите имя пользователя:</b><br>
<input type=text value="" size=30 maxlength=25 name="user"><br>
<input type=hidden value="del" name="action">
<input type=submit value="Исключить из модераторов">
</td></tr>
</table>
</center>
<fieldset>
<legend>Список модераторов чата: </legend>
<?
echo "<font color=#0000ff><b>";
$res=mysql_query("select username from tb_users where chatmoder='1' order by id asc");
$kol=mysql_num_rows($res);
if($kol>0)
{
$row=mysql_fetch_array($res);
echo $row["username"];
while($row=mysql_fetch_array($res))
{
if($row["username"]!='') echo ", ".$row["username"];
}
}else{
echo "Модераторы не назначены";
}
echo "</b></font>";
?>
</fieldset>