This is how my inc_subscription looks like :
' This sub checks against the subscriptions table looking for a subscription based
' on the level passed in. If one exists, it builds the link the unsubscribe,
' otherwise it builds the link to subscribe.
sub CheckSubscription(SubType, MemberID, CatID, ForumID, TopicID, strBefore, strAfter)
'-- Subscribe checkbox -----
Dim postForm
If Instr(request.servervariables("SCRIPT_NAME"),"post.asp") then
postForm = true
else
postForm = false
end if
'-- Subscribe checkbox end -
if mlev = 0 then
exit sub
end if
if instr(1, SubType, "NOTEXT") > 0 then
SubType = Replace(SubType, "NOTEXT", "")
Text = "N"
end if
' Check for overriding subscriptions
if SubType <> "BOARD" then
StrSql = "SELECT Count(*) as SubCount from " & strTablePrefix & "SUBSCRIPTIONS S" & _
" WHERE S.MEMBER_ID = " & MemberID & _
" AND ((S.CAT_ID = 0 and S.FORUM_ID = 0 and S.TOPIC_ID = 0)" ' Board Level Subscription
if SubType <> "CAT" then
StrSql = StrSql & " OR (S.CAT_ID = " & CatID & " and S.FORUM_ID = 0 and S.TOPIC_ID = 0)" ' Cat level subscription
end if
if SubType = "TOPIC" then
StrSql = StrSql & " OR (S.CAT_ID = " & CatID & " and S.FORUM_ID = " & ForumID & " and S.TOPIC_ID = 0)" ' Forum level subscription
end if
StrSql = StrSql & ")"
Set rsCount = Server.CreateObject("ADODB.Recordset")
rsCount.open strSql, my_Conn
if rsCount.BOF or rsCount.EOF then
rsCount.Close
set rsCount = nothing
' No Subscriptions found, do nothing
else
SubCount = rsCount("SubCount")
rsCount.Close
set rsCount = nothing
if SubCount > 0 then
' Higher Level Subscriptions found, exit.
Exit Sub
end if
end if
end if
' Can only have subscriptions if email is enabled and user is a member.
if (lcase(strEmail) = "1") and mlev <> 0 then
dim LinkInfo
LinkInfo = "LEVEL="
LinkInfo = LinkInfo & SubType
' Look for a current subscription for this member to determine which icon to display.
' Also start to build the appropriate querystring for the link
strSql = "Select Count(*) as MemberCheck " &_
" FROM " & strTablePrefix & "SUBSCRIPTIONS S" &_
" WHERE S.MEMBER_ID = " & MemberID &_
" AND S.TOPIC_ID = "
if SubType = "TOPIC" then
strSql = strSql & TopicID
else
strSql = strSql & "0 "
end if
strSql = strSql & " AND S.FORUM_ID = "
if SubType = "CAT" or SubType = "FORUM" or SubType = "TOPIC" then
strSql = strSql & ForumID
else
strSql = strSql & "0 "
end if
strSql = strSql & " AND S.CAT_ID = "
if SubType <> "BOARD" then
strSql = strSql & CatID
else
strSql = strSql & "0 "
end if
if SubType <> "BOARD" then
LinkInfo = LinkInfo & "&CAT_ID=" & CatID
if SubType <> "CAT" then
LinkInfo = LinkInfo & "&FORUM_ID=" & ForumID
if SubType <> "FORUM" then
LinkInfo = LinkInfo & "&TOPIC_ID=" & TopicID
end if
end if
end if
Set rsWatch = Server.CreateObject("ADODB.Recordset")
rsWatch.open strSql, my_Conn
' Complete the LinkInfo by adding the member_id to the link
LinkInfo = LinkInfo & "&MEMBER_ID=" & MemberID & "');"">"
Response.Write "<font face='" & strDefaultFontFace & "' size='" & strDefaultFontSize & "'>"
If rsWatch("MemberCheck") > 0 then
'-- Subscribe checkbox -----
if not postForm then
Response.Write strBefore & "<a href=""Javascript:openWindow('pop_subscription.asp?SUBSCRIBE=U&" & LinkInfo
Response.Write "<img src='" & strImageURL & "icon_unsubscribe.gif' height=15 width=15 border=0 alt='Unsubscribe'>"
If Text <> "N" then
Response.Write "</a> <a href=""Javascript:openWindow('pop_subscription.asp?SUBSCRIBE=U&" & LinkInfo
Response.Write "Unsubscribe from "
end if
else
response.write "<input type='checkbox' name='Tnotify' value='0' >Check here to unsubscribe from this topic"
end if
Else
if not postForm then
Response.Write strBefore & "<a href=""Javascript:openWindow('pop_subscription.asp?SUBSCRIBE=S&" & LinkInfo
Response.Write "<img src='" & strImageURL & "icon_subscribe.gif' height=15 width=15 border=0 alt='Subscribe to this " & SubType & "'>"
If Text <> "N" then
Response.Write "</a> <a href=""Javascript:openWindow('pop_subscription.asp?SUBSCRIBE=S&" & LinkInfo
Response.Write "Subscribe to "
end if
else
response.write "<input type='checkbox' name='Tnotify' value='1' >Check here to subscribe to this topic"
end if
End If
if not postForm then
'-- Subscribe checkbox end -
If Text <> "N" then
Response.Write " <a href=""Javascript:openWindow('pop_subscription.asp?SUBSCRIBE=U&" & LinkInfo
' Response.Write "Unsubscribe from "
if SubType = "BOARD" then
Response.Write "<img src='forumuit.gif' border=0 alt='UnSubscribe'></a>"
elseif SubType = "CAT" then
Response.Write "<img src='catuit.gif' border=0 alt='UnSubscribe'></a>"
elseif SubType = "FORUM" then
Response.Write "<img src='catuit.gif' border=0 alt='UnSubscribe'></a>"
else
Response.Write "<img src='topicuit.gif' border=0 alt='UnSubscribe'></a>"
end if
else
Response.Write strBefore & "<a href=""Javascript:openWindow('pop_subscription.asp?SUBSCRIBE=U&" & LinkInfo
Response.Write "<img src='icon_unsubscribe.gif' border=0 alt='Unsubscribe'>"
end if
' Else
' If Text <> "N" then
' Response.Write " <a href=""Javascript:openWindow('pop_subscription.asp?SUBSCRIBE=S&" & LinkInfo
' Response.Write "Subscribe to "
' if SubType = "BOARD" then
' Response.Write "<img src='forumaan.gif' border=0 alt='Subscribe'></a></a>"
' elseif SubType = "CAT" then
' Response.Write "<img src='cataan.gif' border=0 alt='Subscribe'></a>"
' elseif SubType = "FORUM" then
' Response.Write "<img src='cataan.gif' border=0 alt='Subscribe'></a>"
' else
' Response.Write "<img src='topicaan.gif' border=0 alt='Subscribe'></a>"
' end if
' else
' Response.Write strBefore & "<a href=""Javascript:openWindow('pop_subscription.asp?SUBSCRIBE=S&" & LinkInfo
' Response.Write "<img src='icon_subscribe.gif' border=0 alt='Subscribe'>"
' end if
' End If
'-- Subscribe checkbox -----
end if
'-- Subscribe checkbox end -
Response.Write strAfter & "</font>"
rsWatch.close
set rsWatch = nothing
end if
end sub
And this is where the error takes place in post.asp :
if strAllowForumCode = "1" then
if strRqMethod = "Edit" or strRqMethod = "EditTopic" or strRqMethod = "Reply" or _
strRqMethod = "ReplyQuote" or strRqMethod = "Topic" or strRqMethod = "TopicQuote" then
%>
<table border=0>
<tr>
<td>
<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><b>Mode:</b>
<select name="font" onChange="thelp(this.options[this.selectedIndex].value)">
<option value="1">Help </option>
<option value="2">Prompt </option>
<option selected value="0">Basic </option>
</select>
</font></td>
</tr>
</table>
<%
end if
end if
if strRqMethod = "Edit" or strRqMethod = "Reply" or strRqMethod = "ReplyQuote" or _
strRqMethod = "Topic" or strRqMethod = "EditTopic" or strRqMethod = "TopicQuote" then
if strRqMethod = "Reply" or strRqMethod = "ReplyQuote" or _
strRqMethod = "Topic" or strRqMethod = "TopicQuote" then
%>
<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">
<input name="Sig" type="checkbox" value="yes" <% if Request.QueryString("poll") <> "1" then %>checked<% end if %>>Klik hier om je handtekening toe te voegen.<br>
<% '-- Subscribe checkbox -----
if strSubscription > 0 and postCat_Subscription > 0 and postForum_Subscription > 0 then
CheckSubscription "TOPIC", getNewMemberNumber(), strRqCatID, strRqForumID, strRqTopicID, "<br>", "<br>"
end if
'-- Subscribe checkbox end - %>
</font>
<%
end if
if ((mLev = 4) or (chkForumModerator(strRqForumId, strDBNTUserName) = "1")) _
and (strRqMethod = "Topic" or strRqMethod = "Reply" or _
strRqMethod = "ReplyQuote" or strRqMethod = "TopicQuote") then %>
<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">
<input name="lock" type="checkbox" value="1">Klik hier om het bericht te sluiten na deze post.<br>
</font>
<%
end if
end if
Response.Write " </td>" & vbNewline
Response.Write " </tr>" & vbNewline
end if
%>
Edited by - kristien on 01 June 2002 06:31:09