<?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 news where name='$_POST[name]'"))==0){
$url=strip_tags($_POST["url"]);
$name=strip_tags($_POST["name"]);
$date=date("Y-m-d");
$sql="INSERT INTO news (date,name,url) VALUES ('$date','$name','$url')";
mysql_query($sql);
echo "操作成功!2秒后自动返回...";
}
else
echo "操作失败!".$_POST["username"]."已存在";
}
if("modify"==$_GET["mod"]){
$password=md5(urlencode($_POST["password"]));
$name=strip_tags($_POST["name"]);
$sql="update user set password='$password',name='$name',auth='$_POST[auth]' where id='$_POST[id]'";
mysql_query($sql);
}
if("delete"==$_GET["mod"]){
mysql_query("delete from news where id=$_GET[id]");
echo "操作成功!2秒后自动返回...";
}
echo "<script>setTimeout('parent.location.reload()',2000);</script>";
?>
</body>
</html>
