📄 savenews.asp
字号:
<!--#include file="../function1/DBOpen.asp"-->
<!--#include file="../function/upload.asp"-->
<%
if session("purview")="" then
response.write "错误!!您没有权限或者连接超时,请重新登陆." %>
<a href="../login.asp" target="_top"><b>登陆</b></a>
<% response.end
end if
set rs=server.createobject("adodb.recordset") '查找审核员权限,文章默认状态
rs.open "select * from news_parameter where parameterid=1",conn,1,1
if not rs.bof and not rs.eof then
if rs("newsstatus")=1 then
newsstatus=1
else
newsstatus=0
end if
if rs("auditer")=1 then
auditer=1
else
auditer=0
end if
else
auditer=0
newsstatus=0
end if
rs.close
set rs=nothing
'以下的这段是要不要支持Html代码的代码
function invert(str)
invert=replace(replace(replace(replace(str,"<","<"),">",">"),chr(13),"<br>")," "," ")
end function
FormSize=Request.TotalBytes
FormData=Request.BinaryRead(FormSize)
Set Fields = GetUpload(FormData)
imgsize= Fields("img").length
imgtype= Fields("img").ContentType
imgdata=Fields("img").Value
typeid=Fields("typeid").Value
page=Fields("page").Value
borderid=Fields("borderid").Value
newsid=Fields("newsid").Value
topic=Fields("topic").Value
ntime=Fields("ntime").Value
keys=Fields("keys").Value
nfrom=Fields("nfrom").Value
yes=Fields("yes").Value
'判断是否要加入HTML代码
if yes="1" then
content=Fields("content").Value
else
content=invert(Fields("content").Value)
end if
if topic="" or keys="" or content="" then
response.write "错误!!带<font color=red>*</font>号的为必填项! <a href='javascript:history.go(-1)'>返回</a>"
response.end
end if
if (session("purview")="99998" and auditer=1) or session("purview")="99999" then
audit=Fields("audit").Value
end if
writer=Fields("writer").Value
action=Fields("action").Value
hit=0
modify=cstr(session("name"))
if (session("purview")="99998" and auditer=1) or session("purview")="99999" or cstr(typeid)=cstr(session("purview")) then
if action="modify" then '*****************************修改文章******************************
set rs=server.createobject("ADODB.recordset")
rs.Open "SELECT * from news Where newsid=" & newsid,conn,1,3
if ntime="" then
response.write "错误!!时间不能为空!!! <a href='javascript:history.go(-1)'>返回</a>"
response.end
end if
if cstr(rs("imgsize"))<>0 then
nochange=Fields("nochange").Value
if nochange<>1 then
if imgtype<>"image/pjpeg" and imgtype<>"image/gif" then
rs("imgsize")=0
else
rs("img").appendchunk imgdata
rs("imgsize")=imgsize
end if
end if
else
if imgtype<>"image/pjpeg" and imgtype<>"image/gif" then
rs("imgsize")=0
else
rs("img").appendchunk imgdata
rs("imgsize")=imgsize
end if
end if
rs("typeid")=typeid
rs("borderid")=borderid
rs("topic")=topic
rs("content")=content
rs("ntime")=ntime
rs("keys")=keys
rs("nfrom")=nfrom
if (session("purview")="99998" and auditer=1) or session("purview")="99999" then
rs("audit")=audit
end if
rs("writer")=writer
rs("modify")=modify
if session("purview")>"99997" then
rs("auditer")=cstr(session("name"))
end if
rs.update
rs.close
set rs=nothing
response.redirect "newsmanage.asp?typeid=" & typeid & "&borderid=" & borderid & "&newsid=" & newsid & "&page=" & page
end if 'action="modify"
if action="add" then '*****************************添加新文章******************************
set rs=server.createobject("ADODB.recordset")
rs.Open "SELECT * from news",conn,1,3
rs.addnew
if imgtype<>"image/pjpeg" and imgtype<>"image/gif" then
rs("imgsize")=0
else
rs("img").appendchunk imgdata
rs("imgsize")=imgsize
end if
rs("typeid")=typeid
rs("borderid")=borderid
rs("topic")=topic
rs("content")=content
rs("keys")=keys
rs("nfrom")=nfrom
rs("ntime")=now()
if (session("purview")="99998" and auditer=1) or session("purview")="99999" then
rs("audit")=audit
else
rs("audit")=newsstatus
end if
rs("writer")=writer
rs("modify")=modify
if session("purview")>"99997" then
rs("auditer")=cstr(session("name"))
end if
rs.update
rs.close
set rs=nothing
response.redirect "newsmanage.asp?typeid=" & typeid & "&borderid=" & borderid & "&newsid=" & newsid
end if 'action="add"
end if 'if auditer=1 or session("purview")="99999" or cstr(request("typeid"))=cstr(session("purview"))
%>
<!--#include file="../function/DBclose.asp"-->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -