save.asp

来自「asp」· ASP 代码 · 共 89 行

ASP
89
字号
<%response.expires=0%>
<!--#include file="../inc/conn.asp"-->
<%
userid=Session("userid")
userlevel=Session("userlevel")
if userid="" or userlevel="" then
  call msgbox("请重新登陆!",0)
end if
if not isnumeric(userid) or not isnumeric(userlevel) then
  call msgbox("请重新登陆!",0)
end if
userid=CCur(userid)
userlevel=CCur(userlevel)

categoryid=strFilter(request("categoryid"),10)
if categoryid="" then
  call msgbox("请正确指定分类!",1)
end if
if not isnumeric(categoryid) then
  call msgbox("请正确指定分类!",1)
end if
categoryid=CCur(categoryid)

if Session("filenum")="" then
  call msgbox("请重新录入",1)
end if

sql="select top 1 categoryname,categoryindex from category where categoryid="&categoryid
rs.open sql,conn,1,1
if not rs.eof then
  cname=rs(0)
else
  rs.close
  call msgbox("该分类不存在!",1)
end if
rs.close


title=strFilter(request("title"),100)
Session("title")=title

content=request("SaveContent")
content=replace(content,vbcrlf,"[BR]")
Session("content")=content

author=strFilter(request("author"),20)
Session("author")=author

source=GetWord(request("source"),100,"")
Session("source")=source

cs=GetLength(content)
if title="" then call msgbox("主题不能为空!","../article/add.asp?categoryid="&categoryid)
if cs<100 then call msgbox("主题内容不能过少!","../article/add.asp?categoryid="&categoryid)

action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")
action = replace(action,"article/save.asp","")
content = replace(content,action,picpath)

sql="select top 1 * from article"
rs.open sql,conn,1,3
rs.addnew
rs("categoryid")="."&categoryid&"."&cname&"."
rs("filenum")	=Session("filenum")
rs("title")	=title
rs("content")	=content
rs("pic")	=Session("photoup")
if author><"" then
  rs("author")	=author
end if
if source><"" then
  rs("source")	=source
end if
rs("csize")	=cs
rs("otime")	=now
rs.update
rs.close

Session("photodata")	=""
Session("editfilenum")	=""
Session("filenum")	=""
Session("title")	=""
Session("content")	=""
Session("author")	=""
Session("source")	=""
Session("photoup")	=0

call msgbox("文章添加成功!","../article/add.asp?categoryid="&categoryid)
%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?