<%

if UserRoleID="" then
UserRoleID=0
elseIf Conn.Execute("Select RoleID From [BBSXP_ForumPermissions] where ForumID="&ForumID&" and RoleID="&UserRoleID&"" ).eof Then
UserRoleID=0
NotFindRole=1
end if

SQL="select * from [BBSXP_ForumPermissions] where ForumID="&ForumID&" and RoleID="&UserRoleID&""
Rs.Open sql,Conn,1,3

	if Rs.eof then
		Rs.addNew
		Rs("ForumID")=ForumID
		Rs.update
	end if

PermissionsView=Rs("PermissionsView")
PermissionsRead=Rs("PermissionsRead")
PermissionsPost=Rs("PermissionsPost")
PermissionsReply=Rs("PermissionsReply")
PermissionsEdit=Rs("PermissionsEdit")
PermissionsDelete=Rs("PermissionsDelete")
PermissionsCreatePoll=Rs("PermissionsCreatePoll")
PermissionsVote=Rs("PermissionsVote")
PermissionsAttachment=Rs("PermissionsAttachment")
PermissionsManage=Rs("PermissionsManage")
Rs.close


if CookieUserName=empty then
	PermissionsPost=0
	PermissionsReply=0
	PermissionsEdit=0
	PermissionsDelete=0
	PermissionsCreatePoll=0
	PermissionsVote=0
	PermissionsAttachment=0
	PermissionsManage=0
elseif (NotFindRole=1 and BestRole=1) or instr("|"&Moderated&"|","|"&CookieUserName&"|")>0 then
	PermissionsView=1
	PermissionsRead=1
	PermissionsPost=1
	PermissionsReply=1
	PermissionsEdit=1
	PermissionsDelete=1
	PermissionsCreatePoll=1
	PermissionsVote=1
	PermissionsAttachment=1
	PermissionsManage=1
end if
%>