<?php
require_once("../global/checkuser2.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="REFRESH" content="2; URL=index.php" />
<title>处理函数</title>
</head>

<body>
<?php
require_once("../global/connect.php");
if("add"==$_GET["mod"]){
if(mysql_num_rows(mysql_query("select * from negative where keyword = '$_POST[keyword]'"))==0){
$keyword=strip_tags($_POST["keyword"]);
$type=strip_tags($_POST["type"]);
$frequency=strip_tags($_POST["frequency"]);
$result=strip_tags($_POST["result"]);
$sendto=strip_tags($_POST["sendto"]);
$sql="INSERT INTO negative (keyword,type,frequency,result,sendto) VALUES ('$keyword','$type','$frequency','$result','$sendto')";
mysql_query($sql);
echo "操作成功!2秒后自动返回...";
}else
echo "操作失败!".$_POST["keyword"]."已存在。";
}
if("modify"==$_GET["mod"]){
//if(mysql_num_rows(mysql_query("select * from negative where keyword = '$_POST[keyword]'"))==0){
$keyword=strip_tags($_POST["keyword"]);
$type=strip_tags($_POST["type"]);
$frequency=strip_tags($_POST["frequency"]);
$result=strip_tags($_POST["result"]);
$sendto=strip_tags($_POST["sendto"]);
$sql="update negative set type='$type',frequency='$frequency',result='$result',sendto='$sendto' where id='$_POST[id]'";
mysql_query($sql);
echo "操作成功!2秒后自动返回...";
}//else
//echo "操作失败!".$_POST["keyword"]."已存在。";
//}
if("delete"==$_GET["mod"]){
mysql_query("delete from negative where id=$_GET[id]");
echo "操作成功!2秒后自动返回...";
}
echo "<script>setTimeout('parent.location.reload()',2000);</script>";
?>
</body>
</html>
