search.asp
Lines 138-217
I am not aware if this has already been addressed somewhere else. Please excuse me for bringing it up if this has been already mentioned earlier.
Lines 185 and 195
select case Request.Cookies(strUniqueID & "Forum")("PRIVATE_" & Forum_Subject)
Above statement refers to variable Forum_Subject to get the information from cookies. But it is initialized nowhere. It seems that intention is to get the Forum_Subject information from the DB. However the Forum subject column is not retrieved from the DB. Following is sql used to get the information from database.
Lines 141-144
allowSql = "SELECT FORUM_ID, F_PRIVATEFORUMS, F_PASSWORD_NEW"
allowSql = allowSql & " FROM " & strTablePrefix & "FORUM"
allowSql = allowSql & " WHERE F_TYPE = 0"
allowSql = allowSql & " ORDER BY FORUM_ID"
IMO, for the code to work as intended, column F_SUBJECT should be added to the sql statement and variable Forum_Subject should be initialized along with other variables (requires changes around lines 160-162 and 166-168).
Code between Lines 138-217 with required changes in red.
Note: some statements are modified to avoid scrolling
if strPrivateForums = "1" and mLev < 4 then
allAllowedForums = ""
allowSql = "SELECT FORUM_ID, F_SUBJECT, F_PRIVATEFORUMS, F_PASSWORD_NEW"
allowSql = allowSql & " FROM " & strTablePrefix & "FORUM"
allowSql = allowSql & " WHERE F_TYPE = 0"
allowSql = allowSql & " ORDER BY FORUM_ID"
set rsAllowed = Server.CreateObject("ADODB.Recordset")
rsAllowed.open allowSql, my_Conn, adOpenForwardOnly, adLockReadOnly, adCmdText
if rsAllowed.EOF then
recAllowedCount = ""
else
allAllowedData = rsAllowed.GetRows(adGetRowsRest)
recAllowedCount = UBound(allAllowedData,2)
end if
rsAllowed.close
set rsAllowed = nothing
if recAllowedCount <> "" then
fFORUM_ID = 0
fF_SUBJECT = 1
fF_PRIVATEFORUMS = 2
fF_PASSWORD_NEW = 3
for RowCount = 0 to recAllowedCount
Forum_ID = allAllowedData(fFORUM_ID,RowCount)
Forum_Subject = allAllowedData(fF_SUBJECT,RowCount)
Forum_PrivateForums = allAllowedData(fF_PRIVATEFORUMS,RowCount)
Forum_FPasswordNew = allAllowedData(fF_PASSWORD_NEW,RowCount)
if mLev = 4 then
ModerateAllowed = "Y"
elseif mLev = 3 and ModOfForums <> "" then
if (strAuthType = "nt") then
if (chkForumModerator(Forum_ID, Session(strCookieURL & "username")) = "1") then
ModerateAllowed = "Y"
else
ModerateAllowed = "N"
end if
else
if (instr("," & ModOfForums & "," ,"," & Forum_ID & ",") > 0) then
ModerateAllowed = "Y"
else
ModerateAllowed = "N"
end if
end if
else
ModerateAllowed = "N"
end if
if ChkDisplayForum(Forum_PrivateForums,Forum_FPasswordNew,Forum_ID,MemberID) = true then
canView = true
select case Forum_PrivateForums
case 2 '## password
select case Request.Cookies(strUniqueID & "Forum")("PRIVATE_" & Forum_Subject)
case Forum_FPasswordNew
canView = true
case else
canView = false
end select
case 3,7 '## Either Password or Allowed Member(already covered)/Member
if MemberID > 0 then
canView = true
else
select case Request.Cookies(strUniqueID & "Forum")("PRIVATE_" & Forum_Subject)
case Forum_FPasswordNew
canView = true
case else
canView = false
end select
end if
case else
canView = true
end select
if canView then
if allAllowedForums = "" then
allAllowedForums = Forum_ID
else
allAllowedForums = allAllowedForums & "," & Forum_ID
end if
end if
end if
next
end if
if allAllowedForums = "" then allAllowedForums = 0
'Response.Write allAllowedForums
end if