View file public_html/admin/chatcens.php

File size: 1.22Kb
<? include('checkcookie.php'); ?>
<h3>Настройка замены запрещенного текста</h3>
<br>

<?
if(isset($_POST["text"]))
{
	$text=$_POST["text"];
	mysql_query("insert into tb_chatcens (text) values ('$text')");
	echo "<font color=\"$00dd00\"><b>Добавлено.</b></font><br>";
}
?>

<form method="post" action="adminmain.php?p=chatcens">
<input type="text" value="" size="30" maxlength="150" name="text">
<input type="submit" value="Добавить">
</form>
<br>

<?
if (isset($_GET["id"]))
{
	$id=$_GET["id"];
	$option=$_GET["option"];

	if ($option=="delete")
	{
		$queryz = "DELETE FROM tb_chatcens WHERE id='$id'";
		mysql_query($queryz) or die(mysql_error());
		echo "<font color=\"#dd0000\"><b>Удалено.</b></font><br><br>";
	}
}
?>

<table cellspacing="0" cellpadding="0">
<tr align="center">
<th>Запрещенный текст</th>
<th>&nbsp;</th>
</tr>
<?
$res = mysql_query("SELECT * FROM tb_chatcens ORDER BY id ASC");
while ($row = mysql_fetch_array($res)) { 

echo "
<tr align=\"center\">
<td>". $row["text"] ."</td>
<td>";
?>
<form method="post" action="adminmain.php?p=chatcens&id=<?=$row["id"] ?>&option=delete">
<input type="submit" value="Удалить" class="button">
</form>
</td>
</tr>

<?

}

?>
</table>