ok here..try this, replace the function with the 1 below
function getActiveCount() 'Returns the number of Active Topics
ActiveSince = Request.Cookies(strCookieURL & "ActiveSince")
'## Do Cookie stuffs with show last date
if Request.form("cookie") = "2" then
ActiveSince = Request.Form("ShowSinceDateTime")
if strSetCookieToForum = 1 then
Response.Cookies(strCookieURL & "ActiveSince").Path = strCookieURL
end if
Response.Cookies(strCookieURL & "ActiveSince") = ActiveSince
end if
Select Case ActiveSince
Case "LastVisit"
lastDate = ""
Case "LastFifteen"
lastDate = DateToStr(DateAdd("n",-15,strForumTimeAdjust))
Case "LastThirty"
lastDate = DateToStr(DateAdd("n",-30,strForumTimeAdjust))
Case "LastFourtyFive"
lastDate = DateToStr(DateAdd("n",-45,strForumTimeAdjust))
Case "LastHour"
lastDate = DateToStr(DateAdd("h",-1,strForumTimeAdjust))
Case "TwoHour"
lastDate = DateToStr(DateAdd("h",-2,strForumTimeAdjust))
Case "LastDay"
lastDate = DateToStr(DateAdd("d",-1,strForumTimeAdjust))
Case "LastWeek"
lastDate = DateToStr(DateAdd("ww",-1,strForumTimeAdjust))
Case "LastMonth"
lastDate = DateToStr(DateAdd("m",-1,strForumTimeAdjust))
Case Else
lastDate = ""
End Select
if IsEmpty(Session(strCookieURL & "last_here_date")) then
Session(strCookieURL & "last_here_date") = ReadLastHereDate(strDBNTUserName)
end if
if lastDate = "" then
lastDate = Session(strCookieURL & "last_here_date")
end If
if Request.Form("AllRead") = "Y" then
lastDate = ChkString(Request.Form("BuildTime"),"SQLString")
'## The redundant line below is necessary, don't delete it.
session(strCookieURL & "last_here_date") = lastDate
Session(strCookieURL & "last_here_date") = lastDate
UpdateLastHereDate lastDate,strDBNTUserName
ActiveSince = ""
end if
if mlev = 3 then
strSql = "SELECT FORUM_ID FROM " & strTablePrefix & "MODERATOR " & _
" WHERE MEMBER_ID = " & MemberID
Set rsMod = Server.CreateObject("ADODB.Recordset")
rsMod.open strSql, my_Conn, adOpenForwardOnly, adLockReadOnly, adCmdText
if rsMod.EOF then
recModCount = ""
else
allModData = rsMod.GetRows(adGetRowsRest)
recModCount = UBound(allModData,2)
end if
RsMod.close
set RsMod = nothing
if recModCount <> "" then
for x = 0 to recModCount
if x = 0 then
ModOfForums = allModData(0,x)
else
ModOfForums = ModOfForums & "," & allModData(0,x)
end if
next
else
ModOfForums = ""
end if
else
ModOfForums = ""
end if
'## Forum_SQL - Get all active topics from last visit
strSql = "SELECT COUNT(*) as activeCount " &_
"FROM " & strMemberTablePrefix & "MEMBERS M, " & _
strTablePrefix & "FORUM F, " & _
strTablePrefix & "TOPICS T, " & _
strTablePrefix & "CATEGORY C, " & _
strMemberTablePrefix & "MEMBERS MEMBERS_1 " & _
"WHERE T.T_LAST_POST_AUTHOR = MEMBERS_1.MEMBER_ID " & _
"AND F.F_TYPE = 0 " & _
"AND F.FORUM_ID = T.FORUM_ID " & _
"AND C.CAT_ID = T.CAT_ID " & _
"AND M.MEMBER_ID = T.T_AUTHOR " & _
"AND (T.T_LAST_POST > '" & lastDate & "'"
' DEM --> if not an admin, all unapproved posts should not be viewed.
if mlev <> 4 then
strSql = strSql & " AND ((T.T_AUTHOR <> " & MemberID &_
" AND T.T_STATUS < 2)" ' Ignore unapproved/held posts
if mlev = 3 and ModOfForums <> "" then
strSql = strSql & " OR T.FORUM_ID IN (" & ModOfForums & ") "
end if
strSql = strSql & " OR T.T_AUTHOR = " & MemberID & ")"
end if
strSql = strSql & ") "
Set rs = Server.CreateObject("ADODB.Recordset")
if strDBType <> "mysql" then rs.cachesize = 50
rs.open strSql, my_Conn, adOpenForwardOnly, adLockReadOnly, adCmdText
if NOT rs.EOF then
getActiveCount = rs("activeCount")
end if
rs.close
set rs = nothing
end function