matrix3_position.asp

来自「这是ASP的OA」· ASP 代码 · 共 92 行

ASP
92
字号
<!-- #include file="const.asp" -->
<%
call opendb()
checkadmin()
dim sql,FID,rs,action,sindex,i,CID
FID=nrequest("FID")
CID=nrequest("CID")
action=trim(request.QueryString("action"))
if FID<>"" then
	sql="select FIndex,CID from m3_forum where FID="&FID&""
	set rs=server.CreateObject("ADODB.RecordSet")
	rs.open sql,conn,1,1
	if rs.eof and rs.bof then
		rs.close
		set rs=nothing
		call closedb()
		response.redirect("error.asp?id=2")
		response.End()
	else
		sindex=cint(rs("FIndex"))
		CID=rs("CID")
		rs.close
		set rs=nothing
	end if
	if action="up" then
		sql="update m3_forum set FIndex=FIndex+1 where FIndex="&sindex-1&" and CID="&CID&""
		conn.execute(sql)
		sql="update m3_forum set FIndex=FIndex-1 where FID="&FID&""
		conn.execute(sql)
	elseif action="down" then
		sql="update m3_forum set FIndex=FIndex-1 where FIndex="&sindex+1&" and CID="&CID&""
		conn.execute(sql)
		sql="update m3_forum set FIndex=FIndex+1 where FID="&FID&""
		conn.execute(sql)
	end if
	sql="select FIndex from m3_forum where CID="&CID&" order by FIndex asc"
	set rs=server.CreateObject("ADODB.RecordSet")
	rs.open sql,conn,1,3
	i=1
	do while not rs.eof
		rs("FIndex")=i
		i=i+1
		rs.update
		rs.movenext
	loop
	rs.close
	set rs=nothing
elseif CID<>"" then
	sql="select CIndex from m3_category where CID="&CID&""
	set rs=server.CreateObject("ADODB.RecordSet")
	rs.open sql,conn,1,1
	if rs.eof and rs.bof then
		rs.close
		set rs=nothing
		call closedb()
		response.redirect("error.asp?id=2")
		response.End()
	else
		sindex=cint(rs("CIndex"))
		rs.close
		set rs=nothing
	end if
	if action="up" then
		sql="update m3_category set CIndex=CIndex+1 where CIndex="&sindex-1&""
		conn.execute(sql)
		sql="update m3_category set CIndex=CIndex-1 where CID="&CID&""
		conn.execute(sql)
	elseif action="down" then
		sql="update m3_category set CIndex=CIndex-1 where CIndex="&sindex+1&""
		conn.execute(sql)
		sql="update m3_category set CIndex=CIndex+1 where CID="&CID&""
		conn.execute(sql)
	end if
	sql="select CIndex from m3_category order by CIndex asc"
	set rs=server.CreateObject("ADODB.RecordSet")
	rs.open sql,conn,1,3
	i=1
	do while not rs.eof
		rs("CIndex")=i
		i=i+1
		rs.update
		rs.movenext
	loop
	rs.close
	set rs=nothing
else
	call msg("Error: Category or Forum ID is required to this opertion")
	response.End()
end if
response.Redirect "matrix3_admin.asp"
call closedb()
%>

⌨️ 快捷键说明

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