📄 admin_lockuser.asp
字号:
Dim reGroupSetting
Dim FoundGroup,FoundUserPermission,FoundGroupPermission
FoundGroup=false
FoundUserPermission=false
FoundGroupPermission=false
set rs=Dvbbs.Execute("select * from dv_UserAccess where uc_boardid="&request("boardid")&" and uc_userid="&request("userid"))
If Not (rs.eof and rs.bof) Then
reGroupSetting=rs("uc_Setting")
FoundGroup=true
FoundUserPermission=true
End If
if not foundgroup then
set rs=Dvbbs.Execute("select * from dv_BoardPermission where boardid="&request("boardid")&" and groupid="&usergroupid)
if not(rs.eof and rs.bof) then
reGroupSetting=rs("PSetting")
FoundGroup=true
FoundGroupPermission=true
end if
end if
if not foundgroup then
set Rs=Dvbbs.Execute("select * from dv_usergroups where usergroupid="&usergroupid)
If rs.eof And rs.bof Then
Response.Write "未找到该用户组!"
response.end
Else
FoundGroup=true
FoundGroupPermission=true
reGroupSetting=rs("GroupSetting")
End If
End If
%>
<FORM METHOD=POST ACTION="?action=saveuserpermission">
<input type=hidden name="userid" value="<%=request("userid")%>">
<input type=hidden name="BoardID" value="<%=request("boardid")%>">
<input type=hidden name="username" value="<%=membername%>">
<input type=hidden name="name" value="<%=membername%>">
<tr>
<td height="23" colspan="3" class=tablebody1><input type=radio name="isdefault" value="1" <%if FoundGroupPermission then%>checked<%end if%>><B>使用用户组默认值</B> (注意: 这将删除任何之前所做的自定义设置)</td>
</tr>
<tr>
<td height="23" colspan="3" class=tablebody1><input type=radio name="isdefault" value="0" <%if FoundUserPermission then%>checked<%end if%>><B>使用自定义设置</B> </td>
</tr>
<%
GroupPermission(reGroupSetting)
%>
<input type=hidden value="yes" name="groupaction">
</FORM>
</table>
<%
End Sub
Sub SaveUserPermission()
if not AdminUserPer then Response.redirect "showerr.asp?ErrCodes=<li>您没有权限执行此操作。&action=OtherErr"
if not isnumeric(request("userid")) then Response.redirect "showerr.asp?ErrCodes=<li>错误的用户参数。&action=OtherErr"
if not isnumeric(request("boardid")) then Response.redirect "showerr.asp?ErrCodes=<li>错误的版面参数。&action=OtherErr"
Dim trs
'最后一次进行验证,主要为验证版主是否所操作的版面版主
Dim reboard_setting,fboardmaster
fboardmaster=false
if Dvbbs.boardmaster and (Not Dvbbs.FoundUserPer) and (not (Dvbbs.master or Dvbbs.superboardmaster)) Then
set rs=Dvbbs.Execute("select boardmaster,parentid,depth,Board_Setting from dv_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=Dvbbs.Execute("select boardmaster from dv_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)&"|","|"&Dvbbs.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 Dvbbs.AddErrMsg "您不是该版面的版主,无权进行用户权限操作。"
end if
Else
Response.redirect "showerr.asp?ErrCodes=<li>您不是该版面的版主,无权进行用户权限操作。&action=OtherErr"
End If
End If
Dim myGroupSetting
Dim IsGroupSetting,MyIsGroupSetting,FoundSetting
myGroupSetting=GetGroupPermission
if request("isdefault")=1 then
Dvbbs.Execute("delete from dv_UserAccess where uc_boardid="&request("boardid")&" and uc_userid="&request("userid"))
Set Rs=Dvbbs.Execute("Select Count(*) from dv_UserAccess where uc_boardid="&request("boardid")&" and uc_userid="&request("userid"))
FoundSetting=Rs(0)
If IsNull(FoundSetting) Or FoundSetting="" Then FoundSetting=0
Set Rs=Dvbbs.Execute("select IsGroupSetting From Dv_Board Where BoardID="&request("boardid"))
If Trim(Rs(0))="" Or IsNull(Rs(0)) Then
MyIsGroupSetting = ""
Else
IsGroupSetting = "," & Rs(0) & ","
If FoundSetting=0 Then IsGroupSetting = Replace(IsGroupSetting,",0","")
IsGroupSetting = Split(IsGroupSetting,",")
For i=1 To Ubound(IsGroupSetting)-1
If i=1 Then
MyIsGroupSetting = IsGroupSetting(i)
Else
MyIsGroupSetting = MyIsGroupSetting & "," & IsGroupSetting(i)
End If
Next
End If
Dvbbs.Execute("update dv_Board set IsGroupSetting='"&MyIsGroupSetting&"' Where BoardID="&request("boardid"))
Set Rs=Nothing
else
set rs=Dvbbs.Execute("select * from dv_UserAccess where uc_boardid="&request("boardid")&" and uc_userid="&request("userid"))
if rs.eof and rs.bof Then
Dvbbs.Execute("insert into Dv_UserAccess (uc_userid,uc_boardid,uc_setting) values ("&request("userid")&","&request("boardid")&",'"&myGroupSetting&"')")
else
Dvbbs.Execute("update dv_UserAccess set uc_setting='"&myGroupSetting&"' where uc_boardid="&request("boardid")&" and uc_userid="&request("userid"))
End If
Set Rs=Dvbbs.Execute("select IsGroupSetting From Dv_Board Where BoardID="&request("boardid"))
If Trim(Rs(0))="" Or IsNull(Rs(0)) Then
MyIsGroupSetting = 0
Else
IsGroupSetting = "," & Rs(0) & ","
IsGroupSetting = Replace(IsGroupSetting,",0","")
IsGroupSetting = IsGroupSetting & "0,"
IsGroupSetting = Split(IsGroupSetting,",")
For i=1 To Ubound(IsGroupSetting)-1
If i=1 Then
MyIsGroupSetting = IsGroupSetting(i)
Else
MyIsGroupSetting = MyIsGroupSetting & "," & IsGroupSetting(i)
End If
Next
End If
Dvbbs.Execute("update dv_Board set IsGroupSetting='"&MyIsGroupSetting&"' Where BoardID="&request("boardid"))
Set Rs=Nothing
end If
sql="insert into Dv_log (l_touser,l_username,l_content,l_ip,l_type) values ('"&username&"','"&Dvbbs.membername&"','用户操作:设置权限。','"&ip&"',5)"
Dvbbs.Execute(SQL)
Dvbbs.Dvbbs_suc("<li>设置用户权限成功。您的操作已经记录")
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=Dvbbs.Execute("select LastPost from dv_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=Dvbbs.Execute("select top 1 T.title,b.Announceid,b.dateandtime,b.username,b.postuserid,b.rootid from "&Dvbbs.NowUseBBS&" b inner join dv_Topic T on b.rootid=T.TopicID where b.boardid="&boardid&" 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=Dvbbs.Execute("select LastPost from dv_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
Dvbbs.Execute("update dv_board set LastPost='"&LastPost&"' where boardid="&SplitUpBoardID(i))
Dvbbs.ReloadBoardCache SplitUpBoardID(i),LastPost,14,0
end if
end if
Next
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,istop
set trs=Dvbbs.Execute("select LastPost,PostTable,istop from dv_Topic where Topicid="&Topicid)
if not (trs.eof and trs.bof) then
LastPostInfo=split(trs(0),"$")
iTotalUseTable=trs(1)
istop=trs(2)
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=Dvbbs.Execute("select top 1 topic,body,Announceid,dateandtime,username,PostUserid,rootid,boardid from "&iTotalUseTable&" where (not boardid in (444,777)) and rootid="&TopicID&" 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
if istop=1 then LastPostTime=dateadd("d",100,LastPostTime)
LastPost=LastPostUser & "$" & LastRootid & "$" & LastPostTime & "$" & replace(left(LastTopic,20),"$","") & "$" & LastPostInfo(4) & "$" & LastPostUserID & "$" & LastID & "$" & BoardID
Dvbbs.Execute("update dv_topic set LastPost='"&LastPost&"',child=child-1,LastPostTime='"&LastPostTime&"' where topicid="&TopicID)
elseif isupdate=1 and not isendreply then
Dvbbs.Execute("update dv_topic set child=child-1 where topicid="&topicid)
end if
set trs=nothing
End Function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -