📄 add.asp
字号:
<%response.expires=0%>
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/vip.asp"-->
<%
if not adminlevel=1 then
call msgbox("管理员级别够!",1)
end if
categoryname = strFilter(request.form("categoryname"),20)
categoryindex = strFilter(request.form("categoryindex"),20)
old = strFilter(request("old"),50)
if categoryindex><"" then
sql="select top 1 categoryid,categorypath,categorysort from category where categoryindex like '"&categoryindex&"'"
rs.open sql,conn,1,1
if not rs.eof then
cid=rs(0)
cpath=rs(1)
csort=rs(2)
else
rs.close
call msgbox("该分类不存在!",1)
end if
rs.close
categorysort=csort
if cpath="" or isNull(cpath) then
call msgbox("请指定上级目录名!再新建下级","chg.asp?categoryid="&cid)
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=CCur(catesort(ubound(catesort,1)))
end if
next
end if
if categoryitem="" then
categoryindex=categoryindex&".1"
else
categoryindex=categoryindex&"."&categoryitem+1
end if
if csort="news" and ubound(nindex)>1 then
call msgbox("对不起,新闻只能分两级!\n\n第一级是以当天日期为目录保存的普通新闻\n\n第二级是以指定目录保存的专题新闻",1)
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=Ccur(rs(0))+1
else
categoryindex=1
end if
rs.close
categorysort="news"
end if
if csort="news" then
if ubound(nindex)=1 then
msg="\n\n该为专题级(第二级),请新建后指定存放位置!\n\n该级不能再新建下级!"
end if
if ubound(nindex)=0 then
msg="\n\n该为日期级(第一级),将自动在该位置下新建以录入日期的目录,请新建后指定存放位置!\n\n该级能新建下级,且下级将默认为专题!"
end if
end if
cmode= "<html>"&vbcrlf
cmode=cmode&"<meta http-equiv=""Pragma"" content=""no-cache"">"&vbcrlf
cmode=cmode&"<meta http-equiv=""Content-Language"" content=""zh-cn"">"&vbcrlf
cmode=cmode&"<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"&vbcrlf
cmode=cmode&"<title>[HOMEPAGE][OTHER]</title>"&vbcrlf
cmode=cmode&"<table border=0 cellPadding=0 cellSpacing=0 width=700 align=center><tbody>"&vbcrlf
cmode=cmode&" <tr><td bgcolor=#EFEFEF valign=top>[TOPPATH]</td></tr>"&vbcrlf
cmode=cmode&" <tr><td bgcolor=#F0F0F0 valign=top>"&vbcrlf
cmode=cmode&"<center><font style=""font:11pt;""><b>[TITLE]</b></font></center>"&vbcrlf
cmode=cmode&"<div align=right>[TIME] [AUTHOER] [SOURCE]</div><br>"&vbcrlf
cmode=cmode&"<font style=""font:10pt;line-height:18pt"">[CONTENT]</font>"&vbcrlf
cmode=cmode&" </td></tr>"&vbcrlf
cmode=cmode&"</table>"&vbcrlf
cmode=cmode&"</html>"
'[HOMEPAGE] => 主页
'[OTHER] => 其它数据
'[TOPPATH] => 数据位置(层次)
'[TIME] => 录入时间
'[AUTHOR] => 录入作者
'[SOURCE] => 资料来源
'[CONTENT] => 资料内容
sql="select * from category"
rs.open sql,conn,1,3
rs.addnew
rs("categoryname") = categoryname
rs("categoryindex") = categoryindex
rs("categorysort") = categorysort
rs("categorymode") = cmode
rs.update
rs.close
call msgbox("分类 ["&categoryname&"] 添加成功!"&msg,"default.asp?category="&old&"&categoryindex="&categoryindex)
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -