<%
select case Request("action")
case "add"
call add()
case "edit"
call edit()
case "savenew"
call savenew()
case "savedit"
call savedit()
case "del"
call del()
case "orders"
call orders()
case "updatorders"
call updateorders()
case "boardorders"
call boardorders()
case "updatboardorders"
call updateboardorders()
case "addclass"
call addclass()
case "saveclass"
call saveclass()
case "del1"
call del1()
case "mode"
call mode()
case "savemod"
call savemod()
case "permission"
call boardpermission()
case "editpermission"
call editpermission()
case "RestoreBoard"
call RestoreBoard()
case else
call boardinfo()
end select
end sub
sub boardinfo()
Dim reBoard_Setting
%>
论坛版面
操作
<%
sql="select * from board order by rootid,orders"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
do while not rs.eof
reBoard_Setting=split(rs("Board_setting"),",")
%>
<%
end sub
sub add()
dim rs_c
set rs_c= server.CreateObject ("adodb.recordset")
sql = "select * from board order by rootid,orders"
rs_c.open sql,conn,1,1
dim boardnum
set rs = server.CreateObject ("Adodb.recordset")
sql="select Max(boardid) from board"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
boardnum=1
else
boardnum=rs(0)+1
end if
if isnull(boardnum) then boardnum=1
rs.close
%>
<%
set rs_c=nothing
set rs=nothing
end sub
sub edit()
dim rs_c
sql = "select * from board order by rootid,orders"
set rs_c=conn.execute(sql)
sql = "select * from board where boardid="&request("editid")
set rs=conn.execute(sql)
%>
<%
rs.close
set rs=nothing
set rs_c=nothing
end sub
sub mode()
dim boarduser
%>
<%
end sub
'保存编辑论坛认证用户信息
'入口:用户列表字符串
sub savemod()
dim boarduser
dim boarduser_1
dim userlen
dim updateinfo
response.write "
论坛设置成功!
"
if trim(request("vipuser"))<>"" then
boarduser=request("vipuser")
boarduser=split(boarduser,chr(13)&chr(10))
for i = 0 to ubound(boarduser)
if not (boarduser(i)="" or boarduser(i)=" ") then
boarduser_1=""&boarduser_1&""&boarduser(i)&","
end if
next
userlen=len(boarduser_1)
if boarduser_1<>"" then
boarduser=left(boarduser_1,userlen-1)
response.write "
"
end if
end if
conn.execute("update board set "&updateinfo&" where boardid="&request("boardid"))
end sub
'保存添加论坛信息
sub savenew()
if request("boardtype")="" then
Errmsg=Errmsg+" "+"
请输入论坛名称。"
Founderr=true
end if
if request("class")="" then
Errmsg=Errmsg+" "+"
请选择论坛分类。"
Founderr=true
end if
if request("readme")="" then
Errmsg=Errmsg+" "+"
请输入论坛说明。"
Founderr=true
end if
if founderr=true then
response.write Errmsg
exit sub
end if
dim boardid
dim rootid
dim parentid
dim depth
dim orders
dim Fboardmaster
dim maxrootid
dim parentstr
if request("class")<>"0" then
set rs=conn.execute("select rootid,boardid,depth,orders,boardmaster,ParentStr from board where boardid="&request("class"))
rootid=rs(0)
parentid=rs(1)
depth=rs(2)
orders=rs(3)
if depth+1>20 then
response.write "本论坛限制最多只能有20级分类"
exit sub
end if
parentstr=rs(5)
else
set rs=conn.execute("select max(rootid) from board")
maxrootid=rs(0)+1
if isnull(MaxRootID) then MaxRootID=1
end if
sql="select boardid from board where boardid="&request("newboardid")
set rs=conn.execute(sql)
if not (rs.eof and rs.bof) then
response.write "您不能指定和别的论坛一样的序号。"
exit sub
else
boardid=request("newboardid")
end if
set rs = server.CreateObject ("adodb.recordset")
sql = "select * from board"
rs.Open sql,conn,1,3
rs.AddNew
if request("class")<>"0" then
rs("depth")=depth+1
rs("rootid")=rootid
rs("orders") = Request.form("newboardid")
rs("parentid") = Request.Form("class")
if ParentStr="0" then
rs("ParentStr")=Request.Form("class")
else
rs("ParentStr")=ParentStr & "," & Request.Form("class")
end if
else
rs("depth")=0
rs("rootid")=maxrootid
rs("orders")=0
rs("parentid")=0
rs("child")=0
rs("parentstr")=0
end if
rs("boardid") = Request.form("newboardid")
rs("boardtype") = Request.Form("boardtype")
rs("readme") = Request.form("readme")
rs("lasttopicnum") = 0
rs("lastbbsnum") = 0
rs("lasttopicnum") = 0
rs("todaynum") = 0
rs("LastPost")="$0$"&Now()&"$$$$$"
rs("Board_Setting")="0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,16240,3,300,gif|jpg|jpeg|bmp|png|rar|txt|zip|mid,0,0,0|24,1,0,300,20,10,9,12,1,10,10,0,0,0,0,1,5,0,1,4,0,0,0,0,0,0,0,0,0"
rs("sid")=request.form("sid")
if Request("boardmaster")<>"" then
rs("boardmaster") = Request.form("boardmaster")
end if
if request.form("indexIMG")<>"" then
rs("indexIMG")=request.form("indexIMG")
end if
rs.Update
rs.Close
if Request("boardmaster")<>"" then call addmaster(Request("boardmaster"),"none",0)
if request("class")<>"0" then
if depth>0 then
'当上级分类深度大于0的时候要更新其父类(或父类的父类)的版面数和相关排序
for i=1 to depth
'更新其父类版面数
if parentid<>"" then
conn.execute("update board set child=child+1 where boardid="&parentid)
end if
'得到其父类的父类的版面ID
set rs=conn.execute("select parentid from board where boardid="&parentid)
if not (rs.eof and rs.bof) then
parentid=rs(0)
end if
'当循环次数大于1并且运行到最后一次循环的时候直接进行更新
if i=depth and parentid<>"" then
conn.execute("update board set child=child+1 where boardid="&parentid)
end if
next
'更新该版面排序以及大于本需要和同在本分类下的版面排序序号
conn.execute("update board set orders=orders+1 where rootid="&rootid&" and orders>"&orders)
conn.execute("update board set orders="&orders&"+1 where boardid="&Request.form("newboardid"))
else
'当上级分类深度为0的时候只要更新上级分类版面数和该版面排序序号即可
conn.execute("update board set child=child+1 where boardid="&request("class"))
set rs=conn.execute("select max(orders) from board where boardid="&Request.form("newboardid"))
conn.execute("update board set orders="&rs(0)&"+1 where boardid="&Request.form("newboardid"))
end if
end if
response.write "
论坛添加成功! 该论坛目前高级设置为默认选项,建议您返回论坛管理中心重新设置该论坛的高级选项
"&str
set rs=nothing
call cache_board()
end sub
'保存编辑论坛信息
sub savedit()
if clng(request("editid"))=clng(request("class")) then
response.write "所属论坛不能指定自己"
exit sub
end if
dim newboardid,maxrootid
dim parentid,boardmaster,depth,child,ParentStr,rootid,iparentid,iParentStr
dim trs,brs,mrs
set rs = server.CreateObject ("adodb.recordset")
sql = "select * from board where boardid="&request("editid")
rs.Open sql,conn,1,3
newboardid=rs("boardid")
parentid=rs("parentid")
iparentid=rs("parentid")
boardmaster=rs("boardmaster")
ParentStr=rs("ParentStr")
depth=rs("depth")
child=rs("child")
rootid=rs("rootid")
'判断所指定的论坛是否其下属论坛
if ParentID=0 then
if clng(request("class"))<>0 then
set trs=conn.execute("select rootid from board where boardid="&request("class"))
if rootid=trs(0) then
response.write "您不能指定该版面的下属论坛作为所属论坛"
exit sub
end if
end if
else
set trs=conn.execute("select boardid from board where ParentStr like '%"&ParentStr&"%' and boardid="&request("class"))
if not (trs.eof and trs.bof) then
response.write "您不能指定该版面的下属论坛作为所属论坛"
response.end
end if
end if
if parentid=0 then
parentid=rs("boardid")
iparentid=0
end if
rs("boardtype") = Request.Form("boardtype")
'rs("parentid") = Request.Form("class")
rs("boardmaster") = Request("boardmaster")
rs("readme") = Request("readme")
rs("indexIMG")=request.form("indexIMG")
rs("sid")=request.form("sid")
rs.Update
rs.Close
set rs=nothing
if request("oldboardmaster")<>Request("boardmaster") then call addmaster(Request("boardmaster"),request("oldboardmaster"),1)
set mrs=conn.execute("select max(rootid) from board")
Maxrootid=mrs(0)+1
'假如更改了所属论坛
'需要更新其原来所属版面信息,包括深度、父级ID、版面数、排序、继承版主等数据
'需要更新当前所属版面信息
'继承版主数据需要另写函数进行更新--取消,在前台可用boardid in parentstr来获得
dim k,nParentStr,mParentStr
dim ParentSql,boardcount
if clng(parentid)<>clng(request("class")) and not (iparentid=0 and cint(request("class"))=0) then
'如果原来不是一级分类改成一级分类
if iparentid>0 and cint(request("class"))=0 then
'更新当前版面数据
conn.execute("update board set depth=0,orders=0,rootid="&maxrootid&",parentid=0,parentstr='0' where boardid="&newboardid)
ParentStr=ParentStr & ","
set rs=conn.execute("select count(*) from board where ParentStr like '%"&ParentStr&"%'")
boardcount=rs(0)
if isnull(boardcount) then
boardcount=1
else
boardcount=boardcount+1
end if
'更新其原来所属论坛版面数
conn.execute("update board set child=child-"&boardcount&" where boardid="&iparentid)
'更新其原来所属论坛数据,排序相当于剪枝而不需考虑
for i=1 to depth
'得到其父类的父类的版面ID
set rs=conn.execute("select parentid from board where boardid="&iparentid)
if not (rs.eof and rs.bof) then
iparentid=rs(0)
conn.execute("update board set child=child-"&boardcount&" where boardid="&iparentid)
end if
next
if child>0 then
'更新其下属论坛数据
'有下属论坛,排序不需考虑,更新下属论坛深度和一级排序ID(rootid)数据
'更新当前版面数据
'ParentStr=ParentStr & ","
i=0
set rs=conn.execute("select * from board where ParentStr like '%"&ParentStr&"%'")
do while not rs.eof
i=i+1
mParentStr=replace(rs("ParentStr"),ParentStr,"")
conn.execute("update board set depth=depth-"&depth&",rootid="&maxrootid&",ParentStr='"&mParentStr&"' where boardid="&rs("boardid"))
rs.movenext
loop
end if
elseif iparentid>0 and cint(request("class"))>0 then
'将一个分论坛移动到其他分论坛下
'获得所指定的论坛的相关信息
set trs=conn.execute("select * from board where boardid="&request("class"))
'得到其下属版面数
ParentStr=ParentStr & ","
set rs=conn.execute("select count(*) from board where ParentStr like '%"&ParentStr&"%'")
boardcount=rs(0)
if isnull(boardcount) then boardcount=1
'在获得移动过来的版面数后更新排序在指定论坛之后的论坛排序数据
conn.execute("update board set orders=orders + "&boardCount&" + 1 where rootid="&trs("rootid")&" and orders>"&trs("orders")&"")
'更新当前版面数据
conn.execute("update board set depth="&trs("depth")&"+1,orders="&trs("orders")&"+1,rootid="&trs("rootid")&",ParentID="&request("class")&",ParentStr='" & trs("parentstr") & "," & trs("boardid") & "' where boardid="&newboardid)
i=1
'如果有则更新下属版面数据
'深度为原有深度加上当前所属论坛的深度
set rs=conn.execute("select * from board where ParentStr like '%"&ParentStr&"%' order by orders")
do while not rs.eof
i=i+1
iParentStr=trs("parentstr") & "," & trs("boardid") & "," & replace(rs("parentstr"),ParentStr,"")
conn.execute("update board set depth=depth+"&trs("depth")&"-"&depth&"+1,orders="&trs("orders")&"+"&i&",rootid="&trs("rootid")&",ParentStr='"&iParentStr&"' where boardid="&rs("boardid"))
rs.movenext
loop
ParentID=request("class")
if rootid=trs("rootid") then
'在同一分类下移动
'更新所指向的上级论坛版面数,i为本次移动过来的版面数
'更新其父类版面数
conn.execute("update board set child=child+"&i&" where (not ParentID=0) and boardid="&parentid)
for k=1 to trs("depth")
'得到其父类的父类的版面ID
set rs=conn.execute("select parentid from board where (not ParentID=0) and boardid="&parentid)
if not (rs.eof and rs.bof) then
parentid=rs(0)
'更新其父类的父类版面数
conn.execute("update board set child=child+"&i&" where (not ParentID=0) and boardid="&parentid)
end if
next
'更新其原父类版面数
conn.execute("update board set child=child-"&i&" where (not ParentID=0) and boardid="&iparentid)
'更新其原来所属论坛数据
'response.write iparentid & " "
for k=1 to depth
'得到其原父类的父类的版面ID
set rs=conn.execute("select parentid from board where (not ParentID=0) and boardid="&iparentid)
if not (rs.eof and rs.bof) then
iparentid=rs(0)
'response.write iparentid & " "
'更新其原父类的父类版面数
conn.execute("update board set child=child-"&i&" where (not ParentID=0) and boardid="&iparentid)
end if
next
else
'更新所指向的上级论坛版面数,i为本次移动过来的版面数
'更新其父类版面数
conn.execute("update board set child=child+"&i&" where boardid="&parentid)
for k=1 to trs("depth")
'得到其父类的父类的版面ID
set rs=conn.execute("select parentid from board where boardid="&parentid)
if not (rs.eof and rs.bof) then
parentid=rs(0)
'更新其父类的父类版面数
conn.execute("update board set child=child+"&i&" where boardid="&parentid)
end if
next
'更新其原父类版面数
conn.execute("update board set child=child-"&i&" where boardid="&iparentid)
'更新其原来所属论坛数据
for k=1 to depth
'得到其原父类的父类的版面ID
set rs=conn.execute("select parentid from board where boardid="&iparentid)
if not (rs.eof and rs.bof) then
iparentid=rs(0)
'更新其原父类的父类版面数
conn.execute("update board set child=child-"&i&" where boardid="&iparentid)
end if
next
end if 'end if rootid=trs("rootid") then
else
'如果原来是一级论坛改成其他论坛的下属论坛
'得到所指定的论坛的相关信息
set trs=conn.execute("select * from board where boardid="&request("class"))
set rs=conn.execute("select count(*) from board where rootid="&rootid)
boardcount=rs(0)
'更新所指向的上级论坛版面数,i为本次移动过来的版面数
ParentID=request("class")
'更新其父类版面数
conn.execute("update board set child=child+"&boardcount&" where boardid="&parentid)
'response.write parentid & "-"&boardcount&" "
for k=1 to trs("depth")
'得到其父类的父类的版面ID
set rs=conn.execute("select parentid from board where boardid="&parentid)
if not (rs.eof and rs.bof) then
parentid=rs(0)
'更新其父类的父类版面数
conn.execute("update board set child=child+"&boardcount&" where boardid="&parentid)
end if
'response.write parentid & "-"&boardcount&" "
next
'在获得移动过来的版面数后更新排序在指定论坛之后的论坛排序数据
conn.execute("update board set orders=orders + "&boardCount&" + 1 where rootid="&trs("rootid")&" and orders>"&trs("orders")&"")
i=0
set rs=conn.execute("select * from board where rootid="&rootid&" order by orders")
do while not rs.eof
i=i+1
if rs("parentid")=0 then
if trs("ParentStr")="0" then
parentstr=trs("boardid")
else
parentstr=trs("parentstr") & "," & trs("boardid")
end if
conn.execute("update board set depth=depth+"&trs("depth")&"+1,orders="&trs("orders")&"+"&i&",rootid="&trs("rootid")&",ParentStr='"&ParentStr&"',parentid="&request("class")&" where boardid="&rs("boardid"))
else
if trs("ParentStr")="0" then
parentstr=trs("boardid") & "," & rs("parentstr")
else
parentstr=trs("parentstr") & "," & trs("boardid") & "," & rs("parentstr")
end if
conn.execute("update board set depth=depth+"&trs("depth")&"+1,orders="&trs("orders")&"+"&i&",rootid="&trs("rootid")&",ParentStr='"&ParentStr&"' where boardid="&rs("boardid"))
end if
rs.movenext
loop
end if
end if
response.write "
论坛修改成功!
"&str
set rs=nothing
set mrs=nothing
set trs=nothing
'cache版面数据
call cache_board()
'end cache
end sub
'删除版面,删除版面帖子,入口:版面ID
sub del()
'更新其上级版面论坛数,如果该论坛含有下级论坛则不允许删除
set rs=conn.execute("select ParentStr,child,depth from board where boardid="&Request("editid"))
if not (rs.eof and rs.bof) then
if rs(1)>0 then
response.write "该论坛含有下属论坛,请删除其下属论坛后再进行删除本论坛的操作"
exit sub
end if
'如果有上级版面,则更新数据
if rs(2)>0 then
conn.execute("update board set child=child-1 where boardid in ("&rs(0)&")")
end if
sql = "delete from board where boardid="&Request("editid")
conn.execute(sql)
for i=0 to ubound(AllPostTable)
sql = "delete from "&AllPostTable(i)&" where boardid="&Request("editid")
conn.execute(sql)
next
end if
set rs=nothing
call cache_board()
response.write "
论坛删除成功!"
end sub
sub orders()
%>
论坛一级分类重新排序修改(请在相应论坛分类的排序表单内输入相应的排列序号)
<%
set rs = server.CreateObject ("Adodb.recordset")
sql="select * from Board where ParentID=0 order by RootID"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "还没有相应的论坛分类。"
else
do while not rs.eof
response.write ""
rs.movenext
loop
%>
请注意,这里一定不能填写相同的序号,否则非常难修复!
<%
end if
rs.close
set rs=nothing
%>
<%
end sub
sub updateorders()
dim cID,OrderID,ClassName
'response.write request.form("cID")(1)
'response.end
cID=replace(request.form("cID"),"'","")
OrderID=replace(request.form("OrderID"),"'","")
set rs=conn.execute("select boardid from board where rootid="&orderid)
if rs.eof and rs.bof then
response.write "设置成功,请返回。"
conn.execute("update board set rootid="&OrderID&" where rootid="&cID)
else
response.write "请不要和其他论坛设置相同的序号"
end if
call cache_board()
end sub
sub boardorders()
%>
论坛N级分类重新排序修改(请在相应论坛分类的排序表单内输入相应的排列序号)
<%
dim trs,uporders,doorders
set rs = server.CreateObject ("Adodb.recordset")
sql="select * from Board order by RootID,orders"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "还没有相应的论坛分类。"
else
do while not rs.eof
response.write ""
uporders=0
doorders=0
rs.movenext
loop
response.write "
"
end if
rs.close
set rs=nothing
%>
<%
end sub
sub updateboardorders()
dim ParentID,orders,ParentStr,child
dim uporders,doorders,oldorders,trs,ii
if not isnumeric(request("editID")) then
response.write "非法的参数!"
exit sub
end if
if request("uporders")<>"" and not Cint(request("uporders"))=0 then
if not isnumeric(request("uporders")) then
response.write "非法的参数!"
exit sub
elseif Cint(request("uporders"))=0 then
response.write "请选择要提升的数字!"
exit sub
end if
'向上移动
'要移动的论坛信息
set rs=conn.execute("select ParentID,orders,ParentStr,child from board where boardid="&request("editID"))
ParentID=rs(0)
orders=rs(1)
ParentStr=rs(2) & "," & request("editID")
child=rs(3)
i=0
'response.write "select boardid,orders from board where ParentID="&ParentID&" and orders<"&orders&" order by orders desc "
if child>0 then
set rs=conn.execute("select count(*) from board where ParentStr like '%"&ParentStr&"%'")
oldorders=rs(0)
else
oldorders=0
end if
'和该论坛同级且排序在其之上的论坛-更新其排序,最末者为当前论坛排序号
set rs=conn.execute("select boardid,orders,child,ParentStr from board where ParentID="&ParentID&" and orders<"&orders&" order by orders desc")
do while not rs.eof
i=i+1
if Cint(request("uporders"))>=i then
'response.write "update board set orders="&orders&" where boardid="&rs(0)&" "
if rs(2)>0 then
ii=0
set trs=conn.execute("select boardid,orders from board where ParentStr like '%"&rs(3)&","&rs(0)&"%' order by orders")
if not (trs.eof and trs.bof) then
do while not trs.eof
ii=ii+1
conn.execute("update board set orders="&orders&"+"&oldorders&"+"&ii&" where boardid="&trs(0))
trs.movenext
loop
end if
end if
conn.execute("update board set orders="&orders&"+"&oldorders&" where boardid="&rs(0))
if Cint(request("uporders"))=i then uporders=rs(1)
end if
orders=rs(1)
rs.movenext
loop
'response.write "update board set orders="&uporders&" where boardid="&request("editID")
'更新所要排序的论坛的序号
conn.execute("update board set orders="&uporders&" where boardid="&request("editID"))
'如果有下属论坛,则更新其下属论坛排序
if child>0 then
i=uporders
set rs=conn.execute("select boardid from board where ParentStr like '%"&ParentStr&"%' order by orders")
do while not rs.eof
i=i+1
conn.execute("update board set orders="&i&" where boardid="&rs(0))
rs.movenext
loop
end if
'response.end
set rs=nothing
set trs=nothing
elseif request("doorders")<>"" then
if not isnumeric(request("doorders")) then
response.write "非法的参数!"
exit sub
elseif Cint(request("doorders"))=0 then
response.write "请选择要下降的数字!"
exit sub
end if
set rs=conn.execute("select ParentID,orders,ParentStr,child from board where boardid="&request("editID"))
ParentID=rs(0)
orders=rs(1)
ParentStr=rs(2) & "," & request("editID")
child=rs(3)
i=0
if child>0 then
set rs=conn.execute("select count(*) from board where ParentStr like '%"&ParentStr&"%'")
oldorders=rs(0)
else
oldorders=0
end if
set rs=conn.execute("select boardid,orders,child,ParentStr from board where ParentID="&ParentID&" and orders>"&orders&" order by orders")
do while not rs.eof
i=i+1
if Cint(request("doorders"))>=i then
if rs(2)>0 then
ii=0
set trs=conn.execute("select boardid,orders from board where ParentStr like '%"&rs(3)&","&rs(0)&"%' order by orders")
if not (trs.eof and trs.bof) then
do while not trs.eof
ii=ii+1
'response.write "update board set orders="&orders&"+"&ii&" where boardid="&trs(0)&"-a "
conn.execute("update board set orders="&orders&"+"&ii&" where boardid="&trs(0))
trs.movenext
loop
end if
end if
'response.write "update board set orders="&orders&" where boardid="&rs(0)&" "
conn.execute("update board set orders="&orders&" where boardid="&rs(0))
if Cint(request("doorders"))=i then doorders=rs(1)
end if
orders=rs(1)
rs.movenext
loop
'response.write "update board set orders="&doorders&" where boardid="&request("editID")&" "
conn.execute("update board set orders="&doorders&" where boardid="&request("editID"))
'如果有下属论坛,则更新其下属论坛排序
if child>0 then
i=doorders
set rs=conn.execute("select boardid from board where ParentStr like '%"&ParentStr&"%' order by orders")
do while not rs.eof
i=i+1
'response.write "update board set orders="&i&" where boardid="&rs(0)&"-b "
conn.execute("update board set orders="&i&" where boardid="&rs(0))
rs.movenext
loop
end if
'response.end
set rs=nothing
set trs=nothing
end if
call cache_board()
response.redirect "admin_board.asp?action=boardorders"
end sub
sub addmaster(s,o,n)
dim arr,pw,oarr
dim classname,titlepic
set rs=conn.execute("select title from usergroups where usergroupid=3")
classname=rs(0)
set rs=conn.execute("select titlepic from usertitle where usergroupid=3 order by Minarticle desc")
if not (rs.eof and rs.bof) then
titlepic=rs(0)
end if
randomize
pw=Cint(rnd*9000)+1000
arr=split(s,"|")
oarr=split(o,"|")
set rs=server.createobject("adodb.recordset")
for i=0 to Ubound(arr)
sql="select * from [user] where username='"& arr(i) &"'"
rs.open sql,conn,1,3
if rs.eof and rs.bof then
rs.addnew
rs("username")=arr(i)
rs("userpassword")=md5(pw)
rs("userclass")=classname
rs("UserGroupID")=3
rs("titlepic")=titlepic
rs("userWealth")=100
rs("userep")=30
rs("usercp")=30
rs("userisbest")=0
rs("userdel")=0
rs("userpower")=0
rs("lockuser")=0
rs.update
str=str&"你添加了以下用户:" &arr(i) &" 密码:"& pw &"
"
else
if rs("UserGroupID")>3 then
rs("userclass")=classname
rs("UserGroupID")=3
rs("titlepic")=titlepic
rs.update
end if
end if
rs.close
next
'判断原版主在其他版面是否还担任版主,如没有担任则撤换该用户职位
if n=1 then
dim iboardmaster
dim UserGrade,article
iboardmaster=false
for i=0 to ubound(oarr)
set rs=conn.execute("select boardmaster from board")
do while not rs.eof
if instr("|"&trim(rs("boardmaster"))&"|","|"&trim(oarr(i))&"|")>0 then
iboardmaster=true
exit do
end if
rs.movenext
loop
if not iboardmaster then
set rs=conn.execute("select userid,UserGroupID,article from [user] where username='"&trim(oarr(i))&"'")
if not (rs.eof and rs.bof) then
if rs(1)>2 then
if not isnumeric(rs(2)) then article=0
set UserGrade=conn.execute("select top 1 usertitle,titlepic,UserGroupID from usertitle where Minarticle<="&rs(2)&" and not MinArticle=-1 order by MinArticle desc,usertitleid")
if not (UserGrade.eof and UserGrade.bof) then
conn.execute("update [user] set UserGroupID="&UserGrade(2)&",titlepic='"&UserGrade(1)&"',userclass='"&UserGrade(0)&"' where userid="&rs(0))
end if
end if
end if
end if
iboardmaster=false
next
end if
set rs=nothing
end sub
sub boardpermission()
dim iUserGroupID(20),UserTitle(20)
dim trs,ars,k,ii
ii=0
set trs=conn.execute("select title,usergroupid from usergroups order by usergroupid")
do while not trs.eof
UserTitle(ii)=trs(0)
iUserGroupID(ii)=trs(1)
ii=ii+1
trs.movenext
loop
%>
<%
set trs=nothing
set ars=nothing
end sub
sub editpermission()
if not isnumeric(request("groupid")) then
response.write "错误的参数!"
exit sub
end if
if request("groupaction")="yes" then
dim GroupSetting
GroupSetting=Request.Form("canview") & "," & Request.Form("canviewuserinfo") & "," & Request.Form("canviewpost") & "," & Request.Form("cannewpost") & "," & Request.Form("canreplymytopic") & "," & Request.Form("canreplytopic") & "," & Request.Form("canpostagree") & "," & Request.Form("canupload") & "," & Request.Form("canpostvote") & "," & Request.Form("canvote") & "," & Request.Form("caneditmytopic") & "," & Request.Form("candelmytopic") & "," & Request.Form("canmovemytopic") & "," & Request.Form("canclosemytopic") & "," & Request.Form("cansearch") & "," & Request.Form("canmailtopic") & "," & Request.Form("canmodify") & "," & Request.Form("cansmallpaper") & "," & Request.Form("candeltopic") & "," & Request.Form("canmovetopic") & "," & Request.Form("canclosetopic") & "," & Request.Form("cantoptopic") & "," & Request.Form("canawardtopic") & "," & Request.Form("canmodifytopic") & "," & Request.Form("canbesttopic") & "," & Request.Form("canAnnounce") & "," & Request.Form("canAdminAnnounce") & "," & Request.Form("canAdminPaper") & "," & Request.Form("canAdminUser") & "," & Request.Form("canDelUserTopic") & "," & Request.Form("canviewip") & "," & Request.Form("canadminip") & "," & Request.Form("cansendsms") & "," & Request.Form("Maxsendsms") & "," & Request.Form("Maxsmsbody") & "," & Request.Form("Maxsmsbox") & "," & Request.Form("canusetitle") & "," & Request.Form("canuseface") & "," & Request.Form("canusesign") & "," & Request.Form("canvieweven") & "," & Request.Form("canuploadnum") & "," & Request.Form("canviewbest") & "," & Request.Form("adminpermission") & "," & request.form("canaward") & "," & request.form("MaxUploadSize") & "," & request.form("canbatchtopic") & "," & request.form("smallpapermoney") & "," & request.form("postagreemoney") & "," & request.form("canadminfile") & "," & request.form("ba1") & "," & request.form("ba2") & "," & request.form("ba3") & "," & request.form("ba4") & "," & request.form("ba5") & "," & request.form("ba6") & "," & request.form("ba7")
Set rs= Server.CreateObject("ADODB.Recordset")
if request("isdefault")=1 then
conn.execute("delete from BoardPermission where BoardID="&request("reBoardID")&" and GroupID="&request("GroupID"))
else
if request("pid")<>"" then
sql="update BoardPermission set PSetting='"&GroupSetting&"' where pid="&request("pid")
else
sql="insert into BoardPermission (BoardID,GroupID,PSetting) values ("&request("reBoardID")&","&request("GroupID")&",'"&GroupSetting&"')"
end if
conn.execute(sql)
end if
set rs=nothing
response.write "修改成功!返回论坛权限管理"
else
Dim reGroupSetting,reBoardID,groupid
Dim Groupname,Boardname,founduserper
founduserper=false
if request("GroupID")<>"" then
set rs=conn.execute("select * from BoardPermission where boardid="&request("reBoardID")&" and GroupID="&request("GroupID"))
if rs.eof and rs.bof then
founduserper=false
else
groupid=rs("groupid")
reGroupSetting=split(rs("PSetting"),",")
reBoardID=rs("boardid")
set rs=conn.execute("select title from UserGroups where usergroupid="&groupid)
groupname=rs("title")
founduserper=true
end if
if not founduserper then
set rs=conn.execute("select * from usergroups where usergroupid="&request("groupid"))
if rs.eof and rs.bof then
response.write "未找到该用户组!"
exit sub
end if
groupid=request("groupid")
reGroupSetting=split(rs("GroupSetting"),",")
reBoardID=request("reBoardID")
Groupname=rs("title")
end if
end if
set rs=conn.execute("select boardtype from board where boardid="&reBoardID)
Boardname=rs("boardtype")
%>
<%
end if
end sub
sub cache_board()
'cache版面数据
myCache.name="BoardJumpList"
Dim BoardJumpList
set rs=conn.execute("select boardid,boardtype,depth from board order by rootid,orders")
do while not rs.EOF
BoardJumpList = BoardJumpList & ""
rs.MoveNext
loop
myCache.add BoardJumpList,dateadd("n",9999,now)
set rs=nothing
'end cache
end sub
sub RestoreBoard()
'按照目前的排序循环i数值更新rootid
'还原所有版面的depth,orders,parentid,parentstr,child为0
i=0
set rs=conn.execute("select boardid from board order by rootid,orders")
do while not rs.eof
i=i+1
conn.execute("update board set rootid="&i&",depth=0,orders=0,ParentID=0,ParentStr='0',child=0 where boardid="&rs(0))
rs.movenext
loop
set rs=nothing
response.write "复位成功,请返回做论坛归属设置。"
call cache_board()
end sub
%>