📄 addfenlei2.asp
字号:
<%id=1
%>
<!-- #include file=../database.asp -->
<%
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from ourusers where Ltrim(Rtrim(username))='supervisor'"
rs.open sql,conn,1,1
if not rs.eof then
if trim(rs("pass"))<>session("pass") then
response.write "<br>错误的密码!"
rs.close
set rs=nothing
conn.close
set conn=nothing
response.end
else
rs.close
end if
else
response.write "错误:用户不存在!"
rs.close
set rs=nothing
conn.close
set conn=nothing
response.end
end if
%>
<!-- Design and Edit By QianFengyun 2000-5-20 -->
<!-- #include file=../change.asp -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0041)http://www.china114net.com 中国114网 -->
<html>
<head>
<title><%=titlename%></title>
<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>
<link rel="stylesheet" type="text/css" href="../html/style.css">
</head>
<BODY vlink=0000ff leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor=ccbbaa>
<%
function strLength(str)
dim WINNT_CHINESE
WINNT_CHINESE=(len("例子")=2)
if WINNT_CHINESE then
dim l,t,c
dim i
l=len(str)
t=l
for i=1 to l
c=asc(mid(str,i,1))
if c<0 then c=c+65536
if c>255 then
t=t+1
end if
next
strLength=t
else
strLength=len(str)
end if
end function
fid=request("fid")
if isNumeric(fid)=0 then fid=1
if fid<0 then fid=0
sql="select max(id) from fenlei"
rs.open sql,conn,1,1
num=rs(0)
if isNumeric(num)=0 then num=0
response.write "<br>共有"&num&"个分类<br>"
rs.close
sql="select * from fenlei where id="&fid
rs.open sql,conn,1,3
if (rs.eof or rs.bof) and fid<>0 then
response.write "没有这个分类!添加出错!"
rs.close
set rs=nothing
conn.close
set conn=nothing
response.end
end if
if fid<>0 then
expediency=rs("expediency")
if expediency>9 then
response.write "层次最多只能有10层,不能再添加子类!!"
rs.close
set rs=nothing
conn.close
set conn=nothing
response.end
end if
end if
dim name(10),nameid(10)
%><table width="715" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<%
fenleidirect=trim(request("fenleidirect"))
if fenleidirect="" then
response.write "错误:请输入目录名称! <a href='javascript:history.go(-1);'>返回</a>"
conn.close
set conn=nothing
response.end
end if
if strLength(fenleidirect)>50 then
response.write "错误:输入的目录名称太长,最多只能有20个字符! <a href='javascript:history.go(-1);'>返回</a>"
conn.close
set conn=nothing
response.end
end if
if inStr(fenleidirect,"*")>0 or inStr(fenleidirect,"?")>0 or inStr(fenleidirect,"/")>0 or inStr(fenleidirect,"\")>0 or inStr(fenleidirect,":")>0 or inStr(fenleidirect,"|")>0 or inStr(fenleidirect,">")>0 or inStr(fenleidirect,"<")>0 then
response.write "错误:输入的目录不能包括*/\:<>|?等字符! <a href='javascript:history.go(-1);'>返回</a>"
conn.close
set conn=nothing
response.end
end if
rname=trim(request.form("inname"))
if rname="" then
response.write "错误:请输入名称! <a href='javascript:history.go(-1);'>返回</a>"
conn.close
set conn=nothing
response.end
end if
if strLength(rname)>50 then
response.write "错误:输入的名称太长,最多只能有50个字符! <a href='javascript:history.go(-1);'>返回</a>"
conn.close
set conn=nothing
response.end
end if
oldrname=rname
oldrname=rname
rname=replace(rname,"'","''")
if fid<>0 then
for i=1 to 10
nameid(i-1)=rs(10+i)
name(i-1)=rs(i)
next
end if
rs.close
sql="select max(id) from fenlei"
set nm=conn.execute(sql)
num=nm(0)
nm.close
'response.write "fid"&fid&"<br>"
'response.write "expediency"&expediency&"<br>"
sql="select * from fenlei where father="&fid&" and fenleidirect='"&replace(fenleidirect,"'","''")&"'"
rs.open sql,conn,1,3
if not rs.eof then
response.write "错误,这个目录名字在这个分类下已经有了,请用其它名字!!"
rs.close
set rs=nothing
conn.close
set conn=nothing
response.end
end if
rs.close
sql="select * from fenlei where father="&fid&" and fenlei"&expediency+1&"='"&rname&"'"
rs.open sql,conn,1,3
if not rs.eof then
response.write "错误,这个名字在这个分类下已经存在了!!"
rs.close
set rs=nothing
conn.close
set conn=nothing
response.end
end if
rs.addnew
if fid<>0 then
for i=1 to 10
rs(10+i)=nameid(i-1)
rs(i)=name(i-1)
next
rs(expediency+1)=oldrname
rs(expediency+1+10)=num+1
rs("expediency")=expediency+1
rs("father")=fid
rs("num")=0
rs.Update
rs(expediency+1+10)=rs("id")
'rs("id")=num+1
rs("fenleidirect")=fenleidirect
else
rs(1)=oldrname
rs(1+10)=num+1
rs("expediency")=1
rs("father")=0
rs("num")=0
if isNumeric(num)=0 then num=0
rs("fenlei1id")=num+1
'response.write "<br>num+1"&num+1
'response.write "<br>rs(fenlei1id):"&rs("fenlei1id")&"<br>"
rs.Update
rs("fenlei1id")=rs("id")
'rs("id")=num+1
rs("fenleidirect")=fenleidirect
end if
rs.Update
response.write "分类名为"&server.htmlencode(oldrname)&"已经成功添加!<br>它的目录名是"
if fenleidirect<>"" then response.write server.htmlencode(fenleidirect)
rs.close
%>
</td>
</tr>
</table>
</BODY>
</HTML>
<%
set rs=nothing
conn.close
set conn=nothing
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -