📄 add.asp
字号:
<%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
categoryname =strFilter(request.form("categoryname"),20)
categoryindex=strFilter(request.form("categoryindex"),20)
categorysort ="article"
if categoryindex><"" then
sql="select top 1 categoryid,categoryname,categorysort,categorymode from category where categoryindex like '"&categoryindex&"'"
rs.open sql,conn,1,1
if not rs.eof then
cid=rs(0)
cname=rs(1)
csort=rs(2)
cmode=rs(3)
else
rs.close
call msgbox("该分类不存在!",1)
end if
rs.close
if csort="news" then
categorysort="news"
end if
sql="select categoryindex from category where categoryindex like '"&categoryindex&".%' order by categoryid ASC"
rs.open sql,conn,1,1
if not rs.eof then
categoryarray=rs.getrows
end if
rs.close
nindex=split(categoryindex,".")
if isarray(categoryarray) then
for i=0 to ubound(categoryarray,2)
catesort=split(categoryarray(0,i),".")
if ubound(catesort,1)=ubound(nindex,1)+1 then
categoryitem=catesort(ubound(catesort,1))
end if
next
end if
if ubound(nindex)=1 then
if cmode="" or isNull(cmode) then
call msgbox("您必须设计最上级的网页的显示模版!","../category/chg.asp?categoryid="&cid)
end if
end if
if categoryitem="" then
categoryindex=categoryindex&".1"
else
categoryindex=categoryindex&"."&categoryitem+1
end if
category=nindex(0)
if csort="news" then
if ubound(nindex)>1 then
call msgbox("对不起,新闻只能分两级!\n\n第一级是以当天日期为目录保存的普通新闻\n\n第二级是以指定目录保存的专题新闻","../category/?category="&cid)
end if
if ubound(nindex)=2 then
msg="\n\n该第二级为专题级,请新建后指定存放位置!\n\n该级不能再新建下级!"
end if
end if
if cname="新闻频道" then
msg="\n\n该第一级为普通级,请新建后指定存放位置,新闻将自动在该位置下新建以录入日期的目录!\n\n该级能新建下级,且下级将默认为专题!"
end if
else
sql="select top 1 categoryindex from category where not categoryindex like '%.%' order by categoryid DESC"
rs.open sql,conn,1,1
if not rs.eof then
categoryindex=rs(0)+1
else
categoryindex=1
end if
rs.close
if categoryname="新闻频道" then
categorysort="news"
end if
category=categoryindex
end if
rs.open "insert into category(categoryname,categoryindex,categorysort) values('"&categoryname&"','"&categoryindex&"','"&categorysort&"')",conn,1,3
call msgbox("分类 ["&categoryname&"] 添加成功!"&msg,"../category/?category="&category&"&categoryindex="&request("categoryindex"))
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -