<?php
require_once("../../global/checkuser1.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 linktype where name='$_POST[name]'"))==0){
$name=strip_tags($_POST["name"]);
$sql="INSERT INTO linktype (name) VALUES ('$name')";
mysql_query($sql);
echo "操作成功!2秒后自动返回...";
}
else
echo "操作失败!".$_POST["name"]."已存在。";
}
if("modify"==$_GET["mod"]){
$sql="update linktype set name='$_POST[name]' where id='$_POST[id]'";
mysql_query($sql);
echo "操作成功!2秒后自动返回...";
}
if("delete"==$_GET["mod"]){
mysql_query("delete from linktype where id=$_GET[id]");
echo "操作成功!2秒后自动返回...";
}
echo "<script>setTimeout('parent.location.reload()',2000);</script>";
?>
</body>
</html>
