<% '############################################################################### '## Copyright (C) 2000 Michael Anderson and Pierre Gorissen '## '## This program is free software; you can redistribute it and/or '## modify it under the terms of the GNU General Public License '## as published by the Free Software Foundation; either version 2 '## of the License, or any later version. '## '## This program is distributed in the hope that it will be useful, '## but WITHOUT ANY WARRANTY; without even the implied warranty of '## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the '## GNU General Public License for more details. '## '## You should have received a copy of the GNU General Public License '## along with this program; if not, write to the Free Software '## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. '## '## Correspondence and Questions can be sent to: '## reinhold@bigfoot.com '## '## or '## '## Snitz Communications '## C/O: Michael Anderson '## PO Box 200 '## Harpswell, ME 04079 '############################################################################### %> <% dim Subscribe, sublevel, CatID, ForumID, TopicID, MemberID, RecordCount, ThisMemberID ' DEM --> Added code for moderation and subscription mLev = cint(chkUser(strDBNTUserName, Request.Cookies(strUniqueID & "User")("Pword"))) MemberID = getMemberNumber(strDBNTUserName) ThisMemberID = cInt(Request("MEMBER_ID")) if (ThisMemberID <> MemberID and mlev = 4) or (MemberID = ThisMemberID) then Subscribe = Request.QueryString("SUBSCRIBE") SubLevel = Request.QueryString("LEVEL") CatID = Request.QueryString("CAT_ID") if CatID = "" then CatId = 0 ForumID = Request.QueryString("FORUM_ID") if ForumID = "" then ForumId = 0 TopicID = Request.QueryString("TOPIC_ID") if TopicID = "" then TopicId = 0 MemberID = Request.QueryString("MEMBER_ID") Response.Write "

" & vbNewline Response.Write "" & vbNewline ' --- Is the member trying to subscribe or unsubscribe?? Select case Subscribe ' --- Unsubscribe case "U" DeleteSubscription sublevel, MemberID, CatID, ForumID, TopicID ' --- Return the appropriate message to the user.... if CheckSubscriptionCount(SubLevel, MemberID, CatID, ForumID, TopicID) > 0 then Response.Write "Subscriptions" else Response.Write "Subscription" end if Response.Write " Cancelled!

" & vbNewline Response.Write "" & vbNewline Response.Write " (Remember to reload the page)

" & vbNewline ' --- Subscribe case "S" ' --- Check for overriding subscriptions to prevent duplicate emails if (sublevel = "TOPIC" or sublevel = "FORUM" or sublevel = "CAT") and (CheckSubscriptionCount("BOARD", MemberID, 0, 0, 0) > 0) then SendHigherLevelMsg "BOARD", 0 elseif (sublevel = "TOPIC" or sublevel = "FORUM") and (CheckSubscriptionCount("CAT", MemberID, CatId, 0, 0) > 0) then SendHigherLevelMsg "CAT", CatId elseif sublevel = "TOPIC" and (CheckSubscriptionCount("FORUM", MemberID, CatID, ForumID, 0) > 0) then SendHigherLevelMsg "FORUM", ForumId else ' Delete any lower subscriptions to prevent duplicates emails..... if SubLevel = "FORUM" or SubLevel = "CAT" or SubLevel = "BOARD" then DeleteSubscription sublevel, MemberID, CatID, ForumID, TopicID end if AddSubscription SubLevel, MemberID, CatID, ForumID, TopicID end if End Select else Response.Write "

You do not have permission to change another users subscription. Only Administrators may change another users subscriptions." & _ "

" & vbNewline ' ## This is just the form which is used to login if the person is ' ## not logged in or does not have access to do the moderation. Response.Write "
" & vbNewline Response.Write "" & vbNewline Response.Write "" & vbNewline Response.Write "" & vbNewline Response.Write "" & vbNewline Response.Write "" & vbNewline Response.Write " " & vbNewline Response.Write " " & vbNewline & " " & vbNewline & "
" & vbNewline Response.Write " " & vbNewline if strAuthType = "db" then Response.Write " " & vbNewline Response.Write " " & vbNewline Response.Write " " & vbNewline Response.Write " " & vbNewline Response.Write " " & vbNewline Response.Write " " & vbNewline Response.Write " " & vbNewline Response.Write " " & vbNewline else Response.Write " " & vbNewline Response.Write " " & vbNewline Response.Write " " & vbNewline Response.Write " " & vbNewline end if Response.Write " " & vbNewline Response.Write " " & vbNewline Response.Write " " & vbNewline & "
User Name:
Password:
NT Account:
" & vbNewline Response.Write "
" & vbNewline Response.Write "
" & vbNewline end if %> <% sub DeleteSubscription(Level, MemberID, CatID, ForumID, TopicID) ' --- Delete the appropriate sublevel of subscriptions StrSql = "DELETE FROM " & strTablePrefix & "SUBSCRIPTIONS" StrSql = StrSql & " WHERE " & strTablePrefix & "SUBSCRIPTIONS.MEMBER_ID = " & MemberID if sublevel = "CAT" then StrSql = StrSQL & " AND " & strTablePrefix & "SUBSCRIPTIONS.CAT_ID = " & CatID elseif sublevel = "FORUM" then StrSql = StrSQL & " AND " & strTablePrefix & "SUBSCRIPTIONS.FORUM_ID = " & ForumID elseif sublevel = "TOPIC" then StrSql = StrSQL & " AND " & strTablePrefix & "SUBSCRIPTIONS.TOPIC_ID = " & TopicID end if my_Conn.Execute (strSql) end sub sub AddSubscription(SubLevel, MemberID, CatID, ForumID, TopicID) ' --- Insert the appropriate sublevel subscription StrSql = "INSERT INTO " & strTablePrefix & "SUBSCRIPTIONS" StrSql = StrSql & "(MEMBER_ID, CAT_ID, FORUM_ID, TOPIC_ID) VALUES (" & MemberID & ", " IF sublevel = "BOARD" then StrSql = StrSql & "0, 0, 0)" ElseIf sublevel = "CAT" then StrSql = StrSql & CatID & ", 0, 0)" ElseIf sublevel = "FORUM" then StrSql = StrSql & CatID & ", " & ForumID & ", 0)" Else StrSql = StrSql & CatID & ", " & ForumID & ", " & TopicID & ")" End if my_Conn.Execute (strSql) Response.Write "You are subscribed to " if sublevel = "BOARD" then Response.Write "
all posts in the " Response.Write "
" & strForumTitle & " forums " elseif sublevel = "CAT" then strSql = "SELECT " & strTablePrefix & "CATEGORY.CAT_NAME " strSql = strSql & "FROM " & strTablePrefix & "CATEGORY " strSql = strSql & "WHERE " & strTablePrefix & "CATEGORY.CAT_ID = " & CatID set rs = my_Conn.Execute (strSql) strCategory = rs("CAT_NAME") rs.close set rs = nothing Response.Write "
all posts in " Response.Write "
" & strCategory elseif sublevel = "FORUM" then strSql = "SELECT " & strTablePrefix & "FORUM.F_SUBJECT " strSql = strSql & "FROM " & strTablePrefix & "FORUM " strSql = strSql & "WHERE " & strTablePrefix & "FORUM.FORUM_ID = " & ForumId set rs = my_Conn.Execute (strSql) strForum = rs("F_SUBJECT") rs.close set rs = nothing Response.Write "
all posts in " Response.Write "
" & strForum else Response.Write "
all replies made to this Topic" end if Response.Write "

" & vbNewline end sub sub SendHigherLevelMsg(SubLevel, Id) ' -- If an overriding subscription is found, return the appropriate error message. dim rs Response.Write "You currently are subscribed to " if sublevel = "BOARD" then Response.Write "
all posts in " & strForumTitle & "" elseif sublevel = "CAT" then strSql = "SELECT " & strTablePrefix & "CATEGORY.C_SUBJECT " strSql = strSql & "FROM " & strTablePrefix & "CATEGORY " strSql = strSql & "WHERE " & strTablePrefix & "CATEGORY.CAT_ID = " & Id set rs = my_Conn.Execute (strSql) strCategory = rs("C_SUBJECT") rs.close set rs = nothing Response.Write "
all posts in " Response.Write "
" & strCategory elseif sublevel = "FORUM" then strSql = "SELECT " & strTablePrefix & "FORUM.F_SUBJECT " strSql = strSql & "FROM " & strTablePrefix & "FORUM " strSql = strSql & "WHERE " & strTablePrefix & "FORUM.FORUM_ID = " & Id set rs = my_Conn.Execute (strSql) strForum = rs("F_SUBJECT") rs.close set rs = nothing Response.Write "
all posts in " Response.Write "
" & strForum end if Response.Write "
This will also mail you notification at the level you requested." & vbCtLf Response.Write "

" & vbNewline end sub function CheckSubscriptionCount(Level, MemberID, CatID, ForumID, TopicID) ' --- Count the number of subscriptions at the appropriate sublevel. dim SubCount StrSql = "SELECT Count(*) as RecordCount from " & strTablePrefix & "SUBSCRIPTIONS S" StrSql = StrSql & " WHERE S.MEMBER_ID = " & MemberID if Level = "CAT" then StrSql = StrSQL & " AND S.CAT_ID = " & CatID elseif Level = "FORUM" then StrSql = StrSQL & " AND S.FORUM_ID = " & ForumID elseif Level = "TOPIC" then StrSql = StrSQL & " AND S.TOPIC_ID = " & TopicID else ' BOARD-level StrSql = StrSQL & " AND S.CAT_ID = 0 " StrSql = StrSQL & " AND S.FORUM_ID = 0 " StrSql = StrSQL & " AND S.TOPIC_ID = 0 " end if set rs1 = my_Conn.Execute (strSql) if rs1.EOF or rs1.BOF then SubCount = 0 Else SubCount = rs1("RecordCount") End if rs1.Close set rs1 = nothing CheckSubscription = SubCount end function %>