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

📄 admin_lockuser.asp

📁 公司企业网站管理系统全站源码,用于企业内部对网站的管理
💻 ASP
📖 第 1 页 / 共 3 页
字号:

	Dim reGroupSetting
	Dim FoundGroup,FoundUserPermission,FoundGroupPermission
	FoundGroup=false
	FoundUserPermission=false
	FoundGroupPermission=false

	set rs=Dvbbs.Execute("select * from dv_UserAccess where uc_boardid="&Dvbbs.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="&Dvbbs.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
	
%>
<style>
TD.forumRow {
	PADDING-RIGHT: 3px; PADDING-LEFT: 3px; BACKGROUND: #F1F3F5; PADDING-BOTTOM: 3px; PADDING-TOP: 3px
}
TD.forumRowHighlight {
	PADDING-RIGHT: 3px; PADDING-LEFT: 3px; BACKGROUND: #E4EDF9; PADDING-BOTTOM: 3px; PADDING-TOP: 3px
}
</style>
<script src="images/manage/admin.js" type="text/javascript"></script>
<FORM METHOD=POST ACTION="?action=saveuserpermission">
<input type=hidden name="userid" value="<%=request("userid")%>">
<input type=hidden name="BoardID" value="<%=Dvbbs.boardid%>">
<input type=hidden name="username" value="<%=membername%>">
<input type=hidden name="name" value="<%=membername%>">
<tr> 
<td height="23" colspan="4" class=tablebody1><input type=radio name="isdefault" value="1" <%if FoundGroupPermission then%>checked<%end if%>><B>使用用户组默认值</B> (注意: 这将删除任何之前所做的自定义设置)</td>
</tr>
<tr> 
<td height="23" colspan="4"  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(Dvbbs.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="&Dvbbs.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="&Dvbbs.boardid&" and uc_userid="&Dvbbs.CheckStr(request("userid")))
	Else
		set rs=Dvbbs.Execute("select * from dv_UserAccess where uc_boardid="&Dvbbs.boardid&" and uc_userid="&Dvbbs.CheckStr(request("userid")))
		if rs.eof and rs.bof Then
			Dvbbs.Execute("insert into Dv_UserAccess (uc_userid,uc_boardid,uc_setting) values ("&Dvbbs.CheckStr(request("userid"))&","&Dvbbs.boardid&",'"&myGroupSetting&"')")						
		else
			Dvbbs.Execute("update dv_UserAccess set uc_setting='"&myGroupSetting&"' where uc_boardid="&Dvbbs.boardid&" and uc_userid="&Dvbbs.CheckStr(request("userid")))
		End If
	End If
	Dim IsGroupSetting1
	IsGroupSetting=Get_board_AccUserList(Dvbbs.boardid)
	IsGroupSetting1=Get_Board_GroupSetting(Dvbbs.boardid)
	If IsGroupSetting="" Then
		IsGroupSetting=IsGroupSetting1
	ElseIf IsGroupSetting1<>"" Then
		IsGroupSetting=IsGroupSetting&","& IsGroupSetting1
	End If
	Dvbbs.Execute("update dv_Board set IsGroupSetting='"&IsGroupSetting&"' Where BoardID="&Dvbbs.boardid)
	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>设置用户权限成功。您的操作已经记录")
	Dvbbs.ReloadBoardCache Dvbbs.boardid
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))
					
				end if
			end if
		Next
		Dvbbs.ReloadBoardCache UpdateBoardID
	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
Function Get_board_AccUserList(bid)
	Dim Rs,tmp
	Set Rs=Dvbbs.Execute("Select uc_userid from dv_UserAccess where uc_boardid="&bid&"")
	tmp=""
	If Not Rs.EOF Then
		Do while Not Rs.EOF
			If tmp="" Then
				tmp="0_"&rs(0)
			Else
				tmp=tmp&",0_"&rs(0)
			End If
		Rs.MoveNext
		Loop
		Get_board_AccUserList=tmp
	Else
		Get_board_AccUserList=""
	End If
	Set Rs=Nothing
End Function
Function Get_Board_GroupSetting(bid)
	Dim Rs,tmp
	Set Rs=Dvbbs.Execute("select GroupID From Dv_BoardPermission Where BoardID="&bid)
	tmp=""
	If Not Rs.EOF Then
		Do while Not Rs.EOF
			If tmp="" Then
				tmp=rs(0)
			Else
				tmp=tmp&","&rs(0)
			End If
		Rs.MoveNext
		Loop
		Get_Board_GroupSetting=tmp
	Else
		Get_Board_GroupSetting=""
	End If
	Set Rs=Nothing
End Function
%>

⌨️ 快捷键说明

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