<% '========================================================= ' File: admin_lockuser.asp ' Version:5.0 ' Date: 2002-10-25 ' Script Written by satan '========================================================= ' Copyright (C) 2001,2002 AspSky.Net. All rights reserved. ' Web: http://www.aspsky.net,http://www.dvbbs.net ' Email: info@aspsky.net,eway@aspsky.net '========================================================= dim username dim locktype dim ip Dim TotalUseTable Dim AdminUserPer Dim UpdateBoardID AdminUserPer=false if (master or boardmaster or superboardmaster) and Cint(GroupSetting(42))=1 then AdminUserPer=true else AdminUserPer=false end if if UserGroupID>3 and Cint(GroupSetting(42))=1 then AdminUserPer=true end if if FoundUserPer and Cint(GroupSetting(42))=1 then AdminUserPer=true elseif FoundUserPer and Cint(GroupSetting(42))=0 then AdminUserPer=false end if ip=replace(Request.ServerVariables("REMOTE_ADDR"),"'","") stats="管理用户" if request("name")="" then Errmsg=Errmsg+"
"+"
  • 请指定所操作的用户!" Founderr=true else username=CheckStr(request("name")) end if call nav() call head_var(2,0,"","") if founderr then call dvbbs_error() else if request("action")="power" then call Poweruser() elseif request("action")="DelTopic" then call DelTopic() elseif request("action")="getpermission" then call boardlist() elseif request("action")="userBoardPermission" then call GetUserPermission() elseif request("action")="saveuserpermission" then call saveuserpermission() elseif request("action")="DelUserReply" then call DelUserReply() else call lockuser() end if if founderr then call dvbbs_error() end if call footer() sub lockuser() dim canlockuser canlockuser=false if (master or boardmaster or superboardmaster) and Cint(GroupSetting(28))=1 then canlockuser=true else canlockuser=false end if if UserGroupID>3 and Cint(GroupSetting(28))=1 then canlockuser=true end if if FoundUserPer and Cint(GroupSetting(28))=1 then canlockuser=true elseif FoundUserPer and Cint(GroupSetting(28))=0 then canlockuser=false end if if not canlockuser then Errmsg=Errmsg+"
    "+"
  • 您没有权限执行此操作。" founderr=true exit sub end if if request("action")="lock_1" then conn.execute("update [user] set LockUser=1 where username='"&username&"' and UserGroupID>1") locktype="锁定" elseif request("action")="lock_2" then conn.execute("update [user] set LockUser=2 where username='"&username&"' and UserGroupID>1") locktype="屏蔽" elseif request("action")="lock_3" then conn.execute("update [user] set LockUser=0 where username='"&username&"' and UserGroupID>1") locktype="解锁" else Errmsg=Errmsg+"
    "+"
  • 请指定正确的参数!" Founderr=true exit sub end if sucmsg="
  • 您选择的用户已经"&locktype&"。" call dvbbs_suc() end sub sub Poweruser() dim title,content dim canlockuser canlockuser=false if (master or boardmaster or superboardmaster) and Cint(GroupSetting(43))=1 then canlockuser=true else canlockuser=false end if if UserGroupID>3 and Cint(GroupSetting(43))=1 then canlockuser=true end if if FoundUserPer and Cint(GroupSetting(43))=1 then canlockuser=true elseif FoundUserPer and Cint(GroupSetting(43))=0 then canlockuser=false end if if not canlockuser then Errmsg=Errmsg+"
    "+"
  • 您没有权限执行此操作。" founderr=true exit sub end if if request("checked")="yes" then dim doWealth,douserEP,douserCP,douserPower dim doWealthMsg,douserEPMsg,douserCPMsg,douserPowerMsg,allMsg if not isnumeric(request("doWealth")) or request("doWealth")="0" or request("doWealth")="" then doWealth=0 doWealthMsg="" else doWealth=request("doWealth") doWealthMsg="金钱" & request("doWealth") & "," end if if not isnumeric(request("douserEP")) or request("douserEP")="0" or request("douserEP")="" then douserEP=0 douserEPMsg="" else douserEP=request("douserEP") douserEPMsg="经验" & request("douserEP") & "," end if if not isnumeric(request("douserCP")) or request("douserCP")="0" or request("douserCP")="" then douserCP=0 douserCPMsg="" else douserCP=request("douserCP") douserCPMsg="魅力" & request("douserCP") & "," end if if not isnumeric(request("douserPower")) or request("douserPower")="0" or request("douserPower")="" then douserPower=0 douserPowerMsg="" else douserPower=request("douserPower") douserPowerMsg="威望" & request("douserPower") end if if doWealthMsg="" and douserEPMsg="" and douserCPMsg="" and douserPowerMsg="" then allmsg="没有对用户进行分值操作" else allmsg="用户操作:" & doWealthMsg & douserEPMsg & douserCPMsg & douserPowerMsg end if 'response.write allmsg 'response.end title=request.form("title") content=request.form("content") content="原因:" & title & content if request.form("title")="" and request.form("content")="" then Errmsg=Errmsg+"
  • 请写明操作原因。" founderr=true exit sub end if sql="insert into log (l_touser,l_username,l_content,l_ip) values ('"&username&"','"&membername&"','用户操作:"&content& ","&allmsg&"','"&ip&"')" conn.execute(sql) if allmsg<>"" then conn.execute("update [user] set userWealth=userWealth+"&doWealth&",userCP=userCP+"&douserCP&",userEP=userEP+"&douserEP&",userPower=userPower+"&douserPower&" where username='"&username&"'") end if locktype="成功操作" sucmsg="
  • 您选择的用户已经"&locktype&"。" call dvbbs_suc() else %>
    论坛管理中心--您要进行的操作是奖励用户
    操作理由 *
    用户操作: 金钱  魅力  经验  威望 *
    请慎重使用管理员的管理职能,管理员所有操作将被记录 
    <% end if end sub '删除用户1-10天内主题 sub deltopic() Dim DelDate,suserid Dim todaynum Dim trs,ii DelDate=checkstr(request.form("delTopicDate")) suserid=checkstr(request.form("SetUserID")) dim canlockuser canlockuser=false if (master or boardmaster or superboardmaster) and Cint(GroupSetting(29))=1 then canlockuser=true else canlockuser=false end if if UserGroupID>3 and Cint(GroupSetting(29))=1 then canlockuser=true end if if FoundUserPer and Cint(GroupSetting(29))=1 then canlockuser=true elseif FoundUserPer and Cint(GroupSetting(29))=0 then canlockuser=false end if if not canlockuser then Errmsg=Errmsg+"
    "+"
  • 您没有权限执行此操作。" founderr=true exit sub end if if DelDate="" or not isnumeric(DelDate) then Errmsg=Errmsg+"
    "+"
  • 非法的参数。" Founderr=true exit sub end if if suserid="" or not isnumeric(suserid) then Errmsg=Errmsg+"
    "+"
  • 非法的参数。" Founderr=true exit sub end if '删除帖子表中数据 '更新用户帖子数,用户删除帖子数为该帖所有回复数,回复人的删除帖子数不更新 ii=0 Set rs=conn.execute("select TopicID,Child,BoardID,PostTable,dateandtime from topic where PostUserID="&suserid&" and locktopic<2 and Datediff('d',DateAndTime,Now())<"&DelDate&"") do while not rs.eof ii=ii+1 TotalUseTable=rs(3) '更新发贴用户数据 conn.execute("update [user] set article=article-1,UserDel=UserDel-"&rs(1)&"-1 where userid="&suserid) '更新主题状态 conn.execute("update topic set locktopic=2 where topicid="&rs(0)) '更新帖子状态 conn.execute("update "&TotalUseTable&" set locktopic=2 where rootid="&rs(0)) if datediff("d",rs(4),Now())=0 then todaynum=rs(1) else todaynum=0 end if '得到该帖子所属论坛的上级论坛ID set trs=conn.execute("select ParentStr from board where boardid="&rs(2)) UpdateBoardID=trs(0) & "," & rs(2) '更新版面数据 conn.execute("update board set lastbbsnum=lastbbsnum-"&rs(1)&"-1,lasttopicNum=lasttopicNum-1,todayNum=todayNum-"&todayNum&" where boardid in ("&UpdateBoardID&")") '更新总数据 conn.execute("update config set TodayNum=todayNum-"&todaynum&",BbsNum=bbsNum-"&rs(1)&"-1,TopicNum=topicNum-1") '更新最后回复数据 LastCount rs(2),rs(0),0,1 rs.movenext loop set rs=nothing set trs=nothing sucmsg="
  • 删除该用户主题"&ii&"条。
  • 该用户删除帖子数为所删帖所有回复数,回复人的删除帖子数不更新" call dvbbs_suc() end sub '删除某用户指定日期内所有回复贴 sub DelUserReply() Dim DelDate,suserid,DelBBS Dim todaynum Dim trs,ii DelDate=checkstr(request.form("delTopicDate")) suserid=checkstr(request.form("SetUserID")) DelBBS=checkstr(request.form("DelBBS")) dim canlockuser canlockuser=false if (master or boardmaster or superboardmaster) and Cint(GroupSetting(29))=1 then canlockuser=true else canlockuser=false end if if UserGroupID>3 and Cint(GroupSetting(29))=1 then canlockuser=true end if if FoundUserPer and Cint(GroupSetting(29))=1 then canlockuser=true elseif FoundUserPer and Cint(GroupSetting(29))=0 then canlockuser=false end if if not canlockuser then Errmsg=Errmsg+"
    "+"
  • 您没有权限执行此操作。" founderr=true exit sub end if if DelDate="" or not isnumeric(DelDate) then Errmsg=Errmsg+"
    "+"
  • 非法的参数。" Founderr=true exit sub end if if suserid="" or not isnumeric(suserid) then Errmsg=Errmsg+"
    "+"
  • 非法的参数。" Founderr=true exit sub end if '删除帖子表中数据 ii=0 set rs=conn.execute("select Announceid,rootid,boardid,dateandtime from "&DelBBS&" where PostUserID="&suserid&" and not ParentID=0 and Locktopic<2 and Datediff('d',Dateandtime,Now())<"&DelDate&"") do while not rs.eof ii=ii+1 '更新发贴用户数据 conn.execute("update [user] set article=article-1,UserDel=UserDel-1,UserWealth=UserWealth-"&Forum_user(3)&",userEP=userEP-"&Forum_user(8)&",userCP=userCP-"&Forum_user(13)&" where userid="&suserid) conn.execute("update "&DelBBS&" set locktopic=2 where Announceid="&rs(0)) isEndReply rs(1),rs(0),1 if datediff("d",rs(3),Now())=0 then todaynum=1 else todaynum=0 end if '得到该帖子所属论坛的上级论坛ID set trs=conn.execute("select ParentStr from board where boardid="&rs(2)) UpdateBoardID=trs(0) & "," & rs(2) '更新版面数据 conn.execute("update board set lastbbsnum=lastbbsnum-1,todayNum=todayNum-"&todayNum&" where boardid in ("&UpdateBoardID&")") '更新总数据 conn.execute("update config set TodayNum=todayNum-"&todaynum&",BbsNum=bbsNum-1") '更新最后回复数据 LastCount rs(2),rs(1),rs(0),2 rs.movenext loop set rs=nothing sucmsg="
  • 删除该用户回复"&ii&"条。" call dvbbs_suc() end sub sub boardlist() dim trs dim dispboard if not AdminUserPer then Errmsg=Errmsg+"
    "+"
  • 您没有权限执行此操作。" founderr=true exit sub else dispboard=true end if response.write "" response.write "" if not isnumeric(request("userid")) then response.write "" founderr=true end if if not founderr then response.write "" '----------------------boardinfo-------------------- response.write "
    编辑"&request("username")&"论坛权限(红色表示该用户在该版面有自定义权限)
    错误的用户参数。
    编辑该用户在其它页面的权限(主要针对短信部分设置)
    点击论坛名称进入编辑状态
    " dim reBoard_Setting,FBoardMaster FBoardMaster=false 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"),",") if rs("parentID")>0 and rs("depth")>0 then set trs=conn.execute("select boardmaster from board where boardid in ("&rs("ParentStr")&") order by orders") do while not trs.eof if Cint(reBoard_Setting(40))=1 and not FBoardMaster then if instr("|"&trs(0)&"|","|"&membername&"|")>0 then FBoardMaster=true else FBoardMaster=false end if end if i=i+1 if FBoardMaster then exit do if i>9 then exit do trs.movenext loop end if if boardmaster and instr("|"&rs("BoardMaster")&"|","|"&membername&"|")=0 then dispboard=false end if if FBoardMaster then dispboard=true if master or superboardmaster then dispboard=true if dispboard then if rs("depth")>0 then for i=1 to rs("depth") response.write " " next end if if rs("child")>0 then response.write "" else response.write "" end if %> &userid=<%=request("userid")%>&name=<%=request("name")%>"> <% set trs=conn.execute("select uc_userid from UserAccess where uc_Boardid="&rs("boardid")&" and uc_userid="&request("userid")) if not (trs.eof and trs.bof) then response.write "" end if if rs("parentid")=0 then response.write "" response.write rs("boardtype") if rs("parentid")=0 then response.write "" if rs("child")>0 then response.write "("&rs("child")&")" end if response.write "
    " FBoardMaster=false dispboard=false rs.MoveNext loop set trs=nothing set rs=nothing response.write "
    " '-------------------end------------------- end if end sub sub GetUserPermission() if not AdminUserPer then Errmsg=Errmsg+"
    "+"
  • 您没有权限执行此操作。" founderr=true exit sub end if dim usertitle if not isnumeric(request("userid")) then errmsg=errmsg+"
  • 错误的用户参数。" founderr=true exit sub end if if not isnumeric(request("boardid")) then errmsg=errmsg+"
  • 错误的版面参数。" founderr=true exit sub end if if not founderr then response.write "" set rs=conn.execute("select u.UserGroupID,ug.title,u.username from [user] u inner join UserGroups UG on u.userGroupID=ug.userGroupID where u.userid="&request("userid")) UserGroupID=rs(0) usertitle=rs(1) membername=rs(2) set rs=conn.execute("select boardtype from board where boardid="&request("boardid")) if rs.eof and rs.bof then boardtype="论坛其他页面" else boardtype=rs(0) end if response.write "" response.write "" Dim reGroupSetting Dim FoundGroup,FoundUserPermission,FoundGroupPermission FoundGroup=false FoundUserPermission=false FoundGroupPermission=false set rs=conn.execute("select * from UserAccess where uc_boardid="&request("boardid")&" and uc_userid="&request("userid")) if not (rs.eof and rs.bof) then reGroupSetting=split(rs("uc_Setting"),",") FoundGroup=true FoundUserPermission=true end if if not foundgroup then set rs=conn.execute("select * from BoardPermission where boardid="&request("boardid")&" and groupid="&usergroupid) if not(rs.eof and rs.bof) then reGroupSetting=split(rs("PSetting"),",") FoundGroup=true FoundGroupPermission=true end if end if if not foundgroup then set rs=conn.execute("select * from usergroups where usergroupid="&usergroupid) if rs.eof and rs.bof then response.write "未找到该用户组!" response.end else FoundGroup=true FoundGroupPermission=true reGroupSetting=split(rs("GroupSetting"),",") end if end if %> "> ">
    编辑 "&membername&" 在 "&boardtype&" 权限
    注意:该用户属于 "&usertitle&" 用户组中,如果您设置了他的自定义权限,则该用户权限将以自定义权限为主
    checked<%end if%>>使用用户组默认值 (注意: 这将删除任何之前所做的自定义设置)
    checked<%end if%>>使用自定义设置
    ==查看权限
    可以浏览论坛 checked<%end if%>> 否checked<%end if%>>
    可以查看会员信息(包括其他会员的资料和会员列表) checked<%end if%>> 否checked<%end if%>>
    可以查看其他人发布的主题 checked<%end if%>> 否checked<%end if%>>
    可以浏览精华帖子 checked<%end if%>> 否checked<%end if%>>
    ==发帖权限
    可以发布新主题 checked<%end if%>> 否checked<%end if%>>
    可以回复自己的主题 checked<%end if%>> 否checked<%end if%>>
    可以回复其他人的主题 checked<%end if%>> 否checked<%end if%>>
    可以在论坛允许评分的时候参与评分(鲜花和鸡蛋)? checked<%end if%>> 否checked<%end if%>>
    参与评分所需金钱
    可以上传附件 checked<%end if%>> 否checked<%end if%>>  发帖可以上传checked<%end if%>> 回复可以上传checked<%end if%>>
    一次最多上传文件个数
    一天最多上传文件个数
    上传文件大小限制 KB
    可以发布新投票 checked<%end if%>> 否checked<%end if%>>
    可以参与投票 checked<%end if%>> 否checked<%end if%>>
    可以发布小字报 checked<%end if%>> 否checked<%end if%>>
    发布小字报所需金钱
    ==帖子/主题编辑权限
    可以编辑自己的帖子 checked<%end if%>> 否checked<%end if%>>
    可以删除自己的帖子 checked<%end if%>> 否checked<%end if%>>
    可以移动自己的帖子到其他论坛 checked<%end if%>> 否checked<%end if%>>
    可以打开/关闭自己发布的主题 checked<%end if%>> 否checked<%end if%>>
    ==其他权限
    可以搜索论坛 checked<%end if%>> 否checked<%end if%>>
    可以使用'发送本页给好友'功能 checked<%end if%>> 否checked<%end if%>>
    可以修改个人资料 checked<%end if%>> 否checked<%end if%>>
    可以浏览论坛事件 checked<%end if%>> 否checked<%end if%>>
    可浏览论坛展区的权限 checked<%end if%>> 否checked<%end if%>>
    ==管理权限
    可以删除其它人帖子 checked<%end if%>> 否checked<%end if%>>
    可以移动其它人帖子 checked<%end if%>> 否checked<%end if%>>
    可以打开/关闭其它人帖子 checked<%end if%>> 否checked<%end if%>>
    可以固顶/解除固顶帖子 checked<%end if%>> 否checked<%end if%>>
    可以进行帖子总固顶操作 checked<%end if%>> 否checked<%end if%>>
    可以奖励/惩罚发贴用户 checked<%end if%>> 否checked<%end if%>>
    可以奖励/惩罚用户 checked<%end if%>> 否checked<%end if%>>
    可以编辑其它人帖子 checked<%end if%>> 否checked<%end if%>>
    可以加入/解除精华帖子 checked<%end if%>> 否checked<%end if%>>
    可以发布公告 checked<%end if%>> 否checked<%end if%>>
    可以管理公告 checked<%end if%>> 否checked<%end if%>>
    可以管理小字报 checked<%end if%>> 否checked<%end if%>>
    可以锁定/屏蔽/解除锁定用户 checked<%end if%>> 否checked<%end if%>>
    可以删除用户1-10天内所发帖子 checked<%end if%>> 否checked<%end if%>>
    可以查看来访IP及来源 checked<%end if%>> 否checked<%end if%>>
    可以限定IP来访 checked<%end if%>> 否checked<%end if%>>
    可以管理用户权限 checked<%end if%>> 否checked<%end if%>>
    可以批量删除帖子(前台) checked<%end if%>> 否checked<%end if%>>
    是否有审核帖子的权限 checked<%end if%>> 否checked<%end if%>>
    是否有进入隐含论坛的权限
    在用户组中开放则可进入所有隐含论坛
    在论坛权限管理中设置可进入设置的版面
    在用户权限管理中设置可进入设置的版面
    checked<%end if%>> 否checked<%end if%>>
    有论坛文件管理权限 checked<%end if%>> 否checked<%end if%>>
    ==短信权限
    可以发送短信 checked<%end if%>> 否checked<%end if%>>
    最多发送用户
    短信内容大小限制 byte
    信箱大小限制 KB
    <% end if end sub sub SaveUserPermission() if not AdminUserPer then Errmsg=Errmsg+"
    "+"
  • 您没有权限执行此操作。" founderr=true exit sub end if if not isnumeric(request("userid")) then errmsg=errmsg+"
  • 错误的用户参数。" founderr=true exit sub end if if not isnumeric(request("boardid")) then errmsg=errmsg+"
  • 错误的版面参数。" founderr=true exit sub end if dim trs '最后一次进行验证,主要为验证版主是否所操作的版面版主 dim reboard_setting,fboardmaster fboardmaster=false if boardmaster and (Not FoundUserPer) and (not (master or superboardmaster)) then set rs=conn.execute("select boardmaster,parentid,depth,Board_Setting from board where boardid="&request("boardid")) if not(rs.eof and rs.bof) then reBoard_Setting=split(rs(3),",") if rs("parentID")>0 and rs("depth")>0 then set trs=conn.execute("select boardmaster from board where boardid in ("&rs("ParentStr")&") order by orders") do while not trs.eof if Cint(reBoard_Setting(40))=1 and not FBoardMaster then if instr("|"&trs(0)&"|","|"&membername&"|")>0 then FBoardMaster=true else FBoardMaster=false end if end if i=i+1 if FBoardMaster then exit do if i>9 then exit do trs.movenext loop end if if not fboardmaster then if instr("|"&rs(0)&"|","|"&membername&"|")=0 then errmsg=errmsg+"
  • 您不是该版面的版主,无权进行用户权限操作。" founderr=true exit sub end if end if else errmsg=errmsg+"
  • 您不是该版面的版主,无权进行用户权限操作。" founderr=true exit sub end if end if dim myGroupSetting myGroupSetting=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") if request("isdefault")=1 then conn.execute("delete from UserAccess where uc_boardid="&request("boardid")&" and uc_userid="&request("userid")) else set rs=conn.execute("select * from UserAccess where uc_boardid="&request("boardid")&" and uc_userid="&request("userid")) if rs.eof and rs.bof then conn.execute("insert into UserAccess (uc_userid,uc_boardid,uc_setting) values ("&request("userid")&","&request("boardid")&",'"&myGroupSetting&"')") else conn.execute("update UserAccess set uc_setting='"&myGroupSetting&"' where uc_boardid="&request("boardid")&" and uc_userid="&request("userid")) end if end if sucmsg="
  • 设置用户权限成功。" call dvbbs_suc() end sub '更新指定论坛信息,取主题和最后回复作者及时间 'flag=1为根据主题ID判断,2为根据回复ID判断是否版面最后回复 function LastCount(boardid,topicid,ireplyid,flag) LastCount=false dim LastTopic,LastRootid,LastPostTime,LastPostUser dim LastPost,uploadpic_n,Lastpostuserid,Lastid Dim trs dim LastPostInfo set trs=conn.execute("select LastPost from board where boardid="&boardid) if not (trs.eof and trs.bof) then LastPostInfo=split(trs(0),"$") if ubound(LastPostInfo)=7 then if flag=1 then if clng(LastPostInfo(6))=topicid then LastCount=true elseif flag=2 then if clng(LastPostInfo(1))=ireplyid then LastCount=true end if end if end if if LastCount then set trs=conn.execute("select top 1 T.title,b.Announceid,b.dateandtime,b.username,b.postuserid,b.rootid from "&NowUseBBS&" b inner join Topic T on b.rootid=T.TopicID where b.boardid="&boardid&" and b.locktopic<2 order by b.announceid desc") if not(trs.eof and trs.bof) then Lasttopic=replace(left(trs(0),15),"$","") LastRootid=trs(1) LastPostTime=trs(2) LastPostUser=trs(3) LastPostUserid=trs(4) Lastid=trs(5) else LastTopic="无" LastRootid=0 LastPostTime=now() LastPostUser="无" LastPostUserid=0 Lastid=0 end if LastPost=LastPostUser & "$" & LastRootid & "$" & LastPostTime & "$" & LastTopic & "$" & uploadpic_n & "$" & LastPostUserID & "$" & LastID & "$" & BoardID Dim SplitUpBoardID,SplitLastPost SplitUpBoardID=split(UpdateBoardID,",") For i=0 to ubound(SplitUpBoardID) set trs=conn.execute("select LastPost from board where boardid="&SplitUpBoardID(i)) if not (trs.eof and trs.bof) then SplitLastPost=split(trs(0),"$") if ubound(SplitLastPost)=7 and clng(LastRootID)<>clng(SplitLastPost(1)) then conn.execute("update board set LastPost='"&LastPost&"' where boardid="&SplitUpBoardID(i)) end if end if Next 'sql="update board set LastPost='"&LastPost&"' where boardid="&boardid 'conn.execute(sql) end if set trs=nothing end function '删除回复过程中判断该回复是否最后发言,如果是则更新主题LastPost数据并回复-1 '入口: 'TopicID--主题ID 'iReplyID--回复ID 'isUpdate--是否更新时间 '出口:isEndReply=true/false function IsEndReply(TopicID,iReplyID,isUpdate) isEndReply=false dim trs dim LastPostInfo,iTotalUseTable dim LastTopic,body,LastRootid,LastPostTime,LastPostUser dim LastPost,uploadpic_n,LastPostUserID,LastID set trs=conn.execute("select LastPost,PostTable from Topic where Topicid="&Topicid) if not (trs.eof and trs.bof) then LastPostInfo=split(trs(0),"$") iTotalUseTable=trs(1) if ubound(LastPostInfo)=7 then if Clng(LastPostInfo(1))=Clng(iReplyID) then isEndReply=true end if end if if isEndReply and isUpdate=1 then set trs=conn.execute("select top 1 topic,body,Announceid,dateandtime,username,PostUserid,rootid,boardid from "&iTotalUseTable&" where rootid="&TopicID&" and locktopic<2 order by Announceid desc") if not(trs.eof and trs.bof) then body=trs(1) LastRootid=trs(2) LastPostTime=trs(3) LastPostUser=replace(trs(4),"$","") LastTopic=left(replace(body,"$",""),20) LastPostUserID=trs(5) LastID=trs(6) BoardID=trs(7) else LastTopic="无" LastRootid=0 LastPostTime=now() LastPostUser="无" LastPostUserID=0 LastID=0 Boardid=0 end if LastPost=LastPostUser & "$" & LastRootid & "$" & LastPostTime & "$" & replace(left(LastTopic,20),"$","") & "$" & LastPostInfo(4) & "$" & LastPostUserID & "$" & LastID & "$" & BoardID conn.execute("update topic set LastPost='"&LastPost&"',child=child-1,LastPostTime='"&LastPostTime&"' where topicid="&TopicID) elseif isupdate=1 and not isendreply then conn.execute("update topic set child=child-1 where topicid="&topicid) end if set trs=nothing end function %>