<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>添加新闻</title>
<LINK href="css.css" rel=stylesheet type=text/css>
</head>
<body>
<!--#include file="conn.asp" -->
<!--#include file="checkout.asp" -->
<%if (session("userkey")=1) then%>
  <script language=javascript>  
    alert( "错误：您无权进行用户管理！"  );
    location.href = "javascript:history.back()"  
  </script>
<%end if%>

<%
op=trim(request("op"))

id=request("id")
id=replace(trim(id),"'","")
id=replace(trim(id)," ","")

if tt="" then
if op="add" then
	set rs = server.CreateObject ("adodb.recordset")
	sql="select * from newlist"
	rs.open sql,conn,1,3
	opt="添加"
end if
	
if op="add" then
	rs.addnew
elseif op="update" then
	set rs = server.CreateObject ("adodb.recordset")
	sql="select * from newlist where id="& id
	rs.open sql,conn,1,3
	opt="修改"
end if

if request("num")<>"" then
	rs("num")=request("num")
end if
rs("code")=trim(request("code"))
rs("title")=trim(request("title"))
rs("img")=trim(request("img"))
rs("Content")=trim(request("Content"))
rs("status")=trim(request("status"))
rs("isnew")=trim(request("isnew"))
rs("addtime")=now()
rs("classMaster")=session("admin_user")
rs("ip")=Request.ServerVariables("REMOTE_ADDR")

rs.update
tt="ok"
	response.write("<table align=center width=95% border=0 cellspacing=3 cellpadding=3><tr><td height=20>当前位置：<a href=main.asp>管理首页</a> >> 添加新闻</td></tr></table>")
	response.write("<table width=95% cellspacing=1 cellpadding=5 bgcolor=#999999 align=center>")
	response.write("<tr bgcolor=#CCCCCC align=center><td colspan=2><b><font color=#cc0000>恭喜，新闻"& opt &"成功！</font></b></td></tr>")
	response.write("<tr bgcolor=#eeeeee><td align=right>标题：</td><td>"&request("Title")&"</td></tr>")
	response.write("<tr bgcolor=#eeeeee><td></td><td>【<a href=news_add.asp?code="& request("code") &"&name="& request("name") &"><font color=red>继续添加</font></a>】&nbsp;&nbsp;【<a href=news_list.asp?code="& request("code") &"&name="& request("name") &"><font color=red>返回新闻列表</font></a>】&nbsp;&nbsp;【<a href=main.asp><font color=red>返回首页</font></a>】</td></tr>")
	response.write("</table>")
	rs.close
	set rs=nothing
else
	response.redirect "main.asp"
	response.end
end if%>
</body>
</html>
