<?php include("dh.php"); 
include("../sql/conn.php");
include("yz.php"); 
$llym = $_SERVER["HTTP_REFERER"];
?>

<?php
if ($_GET['s']=="ok")
{
mysql_query("DELETE FROM ck WHERE id='".$_GET['id']."'");

mysql_query("INSERT INTO text (name, time, ip, ing, f, bz) 
VALUES ('".$_SESSION['name']."', '".$noww."', '".$iipp."', '词库删除".$_GET['id']."', '0', '')");
?>
<script language="javascript">setTimeout(function (){location.href='<?php echo $llym; ?>';},2);</script>
<?
}

?>

<?php
if ($_GET['xg']=="xg")
{
mysql_query("UPDATE ck SET old = '".$_POST['old']."' WHERE id='".$_GET['id']."'");
mysql_query("UPDATE ck SET new = '".$_POST['new']."' WHERE id='".$_GET['id']."'");
mysql_query("UPDATE ck SET bz = '".$_POST['bz']."' WHERE id='".$_GET['id']."'");

mysql_query("INSERT INTO text (name, time, ip, ing, f, bz) 
VALUES ('".$_SESSION['name']."', '".$noww."', '".$iipp."', '改词库-".$_GET['id']."', '0', '')");
?>
<script language="javascript">setTimeout(function (){location.href='<?php echo $llym; ?>';},2);</script>
<?
}
?>

<?php
if ($_GET['id']=="ckj")
{
mysql_query("INSERT INTO ck (old,new,bz) VALUES ('$_POST[old]','$_POST[new]','$_POST[bz]')");

mysql_query("INSERT INTO text (name, time, ip, ing, f, bz) 
VALUES ('".$_SESSION['name']."', '".$noww."', '".$iipp."', '添加词条', '0', '')");
?>
<script language="javascript">setTimeout(function (){location.href='<?php echo $llym; ?>';},2);</script>
<?
}
?>


<?php

if($_GET['ys'])
{
$ys = $_SESSION['ts']*($_GET['ys']-1);
}	 
else
{
$ys = 0;
}

if($_GET['px'])
{
$px = $_GET['px'];
}	 
else
{
$px = id;
}

?>

 
 <?php
echo "<TABLE><TR  bgcolor=#CCCC00 >";
echo "<b><TD >ID</td>";
echo "</td><td>源词</td><td>新词</td><td>备注</td><TD >-</td><TD >删</td></b></TR>";

$result = mysql_query("SELECT * FROM ck ORDER  BY ".$px." DESC LIMIT ".$ys.",".$_SESSION['ts']);
while($row = mysql_fetch_array($result))
  {
echo "<TR ";
?> onmouseover="this.style.background='#FFF'; " onmouseout ="this.style.background=''; this.style.borderColor=''" <?php 
echo "><form action=ck.php?xg=xg&id=".$row['id']." method=post>";
echo "<TD ><input type=text value=".$row['id'] . " /></a></td>";
echo "<TD ><input name=old type=text value=".$row['old'] . " /></td>";
echo "<TD ><input name=new type=text value=".$row['new'] . " /></td>";
echo "<TD ><input name=bz type=text value=".$row['bz'] . " /></td>";
echo "<TD ><input type=submit value=修改 /></td>";
echo "<TD ><a href='?id=".$row['id']."&s=ok' >删</a></td>";
echo "</form></TR>";
  }
echo "</TABLE>";

?>

<hr>
<table>
<form action="ck.php?id=ckj" method="post"><tr>
<td>源词:</td>
<td><input name="old" type="text"  /></td>
<td>新词:</td>
<td><input name="new" type="text"  /></td>
<td>备注:</td>
<td><input name="bz" type="text"   /></td>
<td><input name="submit" type="submit" value="增加" /></td>
</tr></form>
</table>
<hr>
 
<?php 

$result = mysql_query("SELECT * FROM ck");//查看总留言数并分页
$num = mysql_num_rows($result);
echo "词条总数".$num." 个";
$ys = ceil($num/$_SESSION['ts']);

for ($i=1; $i<=$ys; $i++)
{
if ($_GET['ys']!=$i)
echo " <a href=?ys=".$i."&px=".$_GET['px'].">".$i."</a> ";
else
echo " <strong>".$i."</strong> ";

}


?> 
<hr>
<textarea cols="88" rows="3">替换词，用于伪原创，和过滤不良词语
</textarea>


<?php include("../sql/close.php"); ?>