📄 admin_announcesave.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="function.asp"-->
<!--#include file="char.asp"-->
<%CheckAdmins
dim id
ID=request("id")
title=request.form("title")
images=request.form("images")
Author=request.form("Author")
DateAndTime=request.form("DateAndTime")
if DateAndTime="" then DateAndTime=date()
Content=request.form("Content")
founerr=false
act=request.form("act")
typeid=request("typeid")
if typeid="" then
founderr=true
errmsg="<li>非法操作</li>"
call error()
end if
if trim(title)="" then
founderr=true
errmsg="<li>标题不能为空</li>"
call error()
end if
if trim(Content)="" then
founderr=true
errmsg="<li>公告内容不能为空</li>"
end if
if founderr=true then
call error()
else
set rs=server.createobject("adodb.recordset")
if act="add" then
call add()
elseif act="edit" then
call edit()
else
founderr=true
errmsg="<li>参数错误</li>"
call error()
response.end
end if
end if
sub add()
sql="select * from Announce"
rs.open sql,conn,1,3
rs.addnew
rs("Title")=Title
rs("type")=typeid
if images="" then
rs("images")=null
else
rs("images")=images
end if
if Author="" then
rs("Author")=null
else
rs("Author")=Author
end if
rs("DateAndTime")=DateAndTime
rs("Content")=htmlencode2(Content)
rs("hits")=0
rs.update
rs.close
end sub
sub edit()
sql="select * from Announce where ID="&ID
rs.open sql,conn,1,3
if rs.eof then
founderr=true
errmsg="<li>没有找到该纪录,可能已经被管理员删除</li>"
call error()
response.end
else
rs("Title")=Title
rs("type")=typeid
if images="" then
rs("images")=null
else
rs("images")=images
end if
if Author="" then
rs("Author")=null
else
rs("Author")=Author
end if
rs("DateAndTime")=DateAndTime
rs("Content")=htmlencode2(Content)
rs.update
end if
rs.close
end sub
set rs=nothing
conn.close
set conn=nothing
Response.Redirect "admin_AnnounceMana.asp?typeid="&request("typeid")
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -