del.asp

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

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

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

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

sql="select categoryindex from category where categoryindex like '"&cindex&".%'"
rs.open sql,conn,1,1
if not rs.eof then
  rs.close
  call msgbox("该分类 ["&cname&"] 存在子分类,必须把全部子分类删除!",1)
end if
rs.close

rs.open "delete from category where categoryid="&categoryid,conn,1,3
if csort="constellation" then
  rs.open "delete from constellation",conn,1,3
else
  rs.open "delete from "&csort&" where categoryid like '."&categoryid&".%'",conn,1,3
  rs.open "delete from "&csort&"photo where categoryid="&categoryid,conn,1,3
end if

call msgbox("成功删除分类 ["&cname&"] ,及所属该类的一切内容!","../category/")
%>

⌨️ 快捷键说明

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