⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 supereditfenlei.asp

📁 中国114网搜索系统 版  本: 文件大小:580 KB 软件语言:简体中文 授权方式:免费版 相关链接:程序演示 开 发 商: 运行环境:ASP源码
💻 ASP
字号:
<%@ LANGUAGE = VBScript%>
<%Server.ScriptTimeout=5000%>
<%
id=1%>
<!-- #include file=../database.asp -->
<%
Set rs = Server.CreateObject("ADODB.Recordset")
function CheckPassword()
	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
end function

checkPassword()
%>
<!-- #include file=makehtmfile.asp -->
<!-- #include file=../change.asp -->

<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 bgcolor=ccbbaa>
<%
rem 移动目录(重命名目录)
function movefloders(tempsource,tempend)

    'on error resume next
    Set fs=Server.CreateObject("Scripting.FileSystemObject")
    if fs.FolderExists(tempend) then
       response.write "<br>目标目录"&tempend&"已存在!"
       set fs=nothing
       movefloders=0
       exit function
    end if
    
    if fs.FolderExists(tempsource) then
    else
       response.write "<br>要移动的源目录"&tempsource&"不存在!"
       set fs=nothing
       movefloders=0
       exit function
    end if
    fs.MoveFolder tempsource,tempend
    response.write "<br>已经成功转移目录"&tempsource&"到"&tempend&"!"
    Set fs=nothing
    movefloders=1

end function

rem 字符串真实长度
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

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

fid=request("fid")
if isNumeric(fid)=0 or fid="" then 
	response.write "操作失败!!"
	conn.close
	set conn=nothing
	response.end
end if
if fid<0 then
	response.write "操作失败!!"
	conn.close
	set conn=nothing
	response.end
end if

sql="select * from fenlei where id="&fid
rs.open sql,conn,1,1
if rs.eof then
	response.write "没有找到这个分类!!操作失败."
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	response.end
end if

expediency=rs("expediency")
father=rs("father")
if trim(request("name"))="" then
	%>
	<table width=700 border="0" cellspacing="0" cellpadding="0" align="center" bgcolor=<%=tablebgcolor1%> height=20>
	<TR align="center">
	<TD bgColor=<%=tablebgcolorbian%>><img src=images/blank.gif height=1></TD>
	</TR>
	<TR align="center">
	<TD height=3><img src=images/blank.gif height=1></TD>
	</TR>
	<tr>
	<td>
	修改分类 &gt; <a href=addfenlei.asp?id=1&fid=0>总分类</a>
	<%
	for i=1 to expediency-1
		response.write " &gt; <a href=addfenlei.asp?id="&id&"&fid="&rs(10+i)&">"&trim(rs(i))&"</a>"
	next
	response.write " &gt; "&trim(rs(i))
	%>
	</td>
	</tr>
	<TR align="center">
	<TD bgColor=<%=tablebgcolorbian%>><img src=images/blank.gif height=1></TD>
	</table>
	<FORM action=supereditfenlei.asp?id=1&fid=<%=fid%> method=post name=form1>
	<p align=center>修改分类</p>
	<br>
	<table width=320 border="0" cellspacing="0" cellpadding="0" align="center">
	<tr>
	<td>注意:修改这个分类将修改所有此分类下的子分类记录!</td>
	</tr>
	</table>
	<br>
	<br>
	<TABLE border=0 class=font style="MARGIN-TOP: -20px; POSITION: relative" width=320 align="center" cellpadding="0" cellspacing="0">
	<TBODY> 
	<TR align=center> 
	<TD colspan="2"> 
	<TABLE border=0 class=font width="100%" cellpadding="0" cellspacing="0">
	<TR> 
	<TD height=2 bgcolor="#ececff"><img src="blank.gif" width=1 height=1></TD>
	<TD height=2 bgcolor="#ececff"><img src="blank.gif" width=1 height=1></TD>
	</TR>
	<TR> 
	<TD height="25" colspan="2">1.*分类名称: 
	<input maxlength=50 name="name" size=28 class="input" value=<%response.write server.htmlencode(trim(rs(expediency)))%>>
	</TD>
	</TR>
	<TR> 
	<TD height="25" colspan="2">1.*目录名称: 
	<input maxlength=50 name="fenleidirect" size=28 class="input" value="<%if trim(rs("fenleidirect"))<>"" then response.write server.htmlencode(trim(rs("fenleidirect")))%>">
	</TD>
	</TR>
	</TABLE>
	</TD>
	</TR>
	<TR>
	<TD colspan="2">&nbsp; </TD>
	</TR>
	<TR>
	<TD width="5%">&nbsp; </TD>
	<TD width="95%" height="30" align="center">
	<input name=submit type=submit value=" 修 改 " class="p9" style="background-color: rgb(145,148,195); color: rgb(255,255,255)" onclick="form_onsubmit(this.form)">
	<input name=b1 type=reset value=" 重 写 " class="p9" style="background-color: rgb(145,148,195); color: rgb(255,255,255)">
	</TD>
	</TR>
	<TR> 
	<TD colspan="2" height=2 bgcolor="ececff"><img src="blank.gif" width=1 height=1></TD>
	</TR>
	</TBODY> 
	</TABLE>
	</FORM>
	<%
else
	rem 保存原来分类在硬盘上的目录
	sourceDir=getfenleidirecttrue(fid)
	
	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

	name=trim(request("name"))
	oldname=name
	if strLength(name)>50 then
		response.write "错误:输入名称的名称太长,最多只能有50个字符! <a href='javascript:history.go(-1);'>返回</a>"
		conn.close
		set conn=nothing
		response.end
	end if
	rs.close
	sql="select * from fenlei where father="&father&" and fenleidirect='"&replace(fenleidirect,"'","''")&"' and id<>"&fid
	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="&father&" and fenlei"&expediency&"='"&replace(name,"'","''")&"' and id<>"&fid
	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

	name=replace(name,"'","''")
	sql="Update fenlei set fenlei"&expediency&"='"&name&"' where fenlei"&expediency&"id="&fid
	conn.execute(sql)
	
	sql="Update fenlei set fenleidirect='"&replace(fenleidirect,"'","''")&"',fenlei"&expediency&"='"&name&"' where id="&fid
	conn.execute(sql)
	response.write "分类名修改成功!!新的分类名为<font color=ff000>"&oldname&"</font>.并且对下级分类都已生效!<br>目录名是"
	
	rem 获得现在分类在硬盘上的目录
	toDir=getfenleidirecttrue(fid)
	
	if fenleidirect<>"" then response.write server.htmlencode(fenleidirect)&"<br>"
	response.write "<br><a href=addfenlei.asp?id="&id&"&fid="&fid&"> <<返回刚才的分类管理.</a>"
	
	response.write "<br><font color=ff0000>现分类目录和文件位置......</font>"
	if movefloders(sourceDir,toDir)=0 and sourceDir<>toDir then
		response.write "<br>更新硬盘上的分类目录失败!所以也没完成上级分类的更新!!"
	else
		response.write "<br>更新硬盘上的分类目录成功!<br>现在开始更新分类的上一级分类的html......."
		
		response.write "father"&father
		if father=0 then
			response.write "<br>正在建总分类......<br>"
			strFenleiDirect=server.mapPath(dirstring&"navigate/")
			response.write strFenleiDirect
			if writeFenleiFiles(strFenleiDirect,0)=0 then
				response.write "<br>建立分类HTM文件失败!"
			else
				response.write "<br>建立分类HTM文件成功!"
			end if
		else
			response.write "<br>正在更新上一级分类......<br>"

			if writeFenleiFiles(getfenleidirecttrue(father),father)=0 then
				response.write "<br>建立分类HTM文件失败!"
			else
				response.write "<br>建立分类HTM文件成功!"
			end if
		end if
	end if
	
	
	Set rs = Server.CreateObject("ADODB.Recordset")
	response.write "<br><font color=ff0000>现在开始更新硬盘上的此分类下的所有子分类......</font>"
	sql="select * from fenlei where fenlei"&expediency&"id="&fid
	rs.open sql,conn,1,1
	do while not rs.eof
		response.write "<br>正在更新下一级分类:"&rs("fenleidirect")&" ......<br>"

		if writeFenleiFiles(getfenleidirecttrue(rs("id")),rs("id"))=0 then
			response.write "<br>建立分类HTM文件失败!"
		else
			response.write "<br>建立分类HTM文件成功!"
		end if
		rs.movenext
	loop
	rs.close
end if
set rs=nothing
conn.close
set conn=nothing
%>
</body>
</html>

⌨️ 快捷键说明

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