Yes, you'll need to use includes. Depending on exactly what counts you desire, the SQL string(s) will be different.
In lines 42-43, you will have to change the "(forumpath)" to reflect your actual forum path: using Snitz for example, you only need the forum/ portion following the ".com/" part of the URL.
Other than that mentioned above, you don't have to change any code to use these. All you need is to create the output where you want them displayed. Samples are provided.
<%
'###############################################################################
'##
'## Snitz Forums 2000 v3.4.07
'##
'###############################################################################
'##
'## Copyright © 2000-06 Michael Anderson, Pierre Gorissen,
'## Huw Reddick and Richard Kinser
'##
'## This program is free. You can redistribute and/or modify it under the
'## terms of the GNU General Public License as published by the Free Software
'## Foundation; either version 2 or (at your option) any later version.
'##
'## All copyright notices regarding Snitz Forums 2000 must remain intact in
'## the scripts and in the HTML output. The "powered by" text/logo with a
'## link back to http://forum.snitz.com in the footer of the pages MUST
'## remain visible when the pages are viewed on the internet or intranet.
'##
'## This program is distributed in the hope that it will be useful but
'## WITHOUT ANY WARRANTY; without even an 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:
'##
'## Free Software Foundation, Inc.
'## 59 Temple Place, Suite 330
'## Boston, MA 02111-1307
'##
'## Support can be obtained from our support forums at:
'##
'## http://forum.snitz.com
'##
'## Correspondence and marketing questions can be sent to:
'##
'## manderson@snitz.com
'##
'###############################################################################
%>
<!--#INCLUDE VIRTUAL="(forumpath)/config.asp"-->
<!--#INCLUDE VIRTUAL="(forumpath)/inc_func_common.asp"-->
<%
dim intMembers, intTopics, intReplies, intMessages
dim intActiveMembers, intGuests, intAuctionItems, intForumTopics
dim intPolls, intQuizzes, intRecipes, intPhotos
set my_Conn = Server.CreateObject("ADODB.Connection")
my_Conn.Open(strConnString)
' ## Obtain counts
strSql = "SELECT COUNT(MEMBER_ID) AS CNT FROM " & strMemberTablePrefix & "MEMBERS WHERE M_STATUS=1"
set rsCount = my_Conn.Execute(strSql)
if not rsCount.EOF then
intMembers=rsCount("CNT")
rsCount.Close
end if
set rsCount = Nothing
strSql = "SELECT COUNT(TOPIC_ID) AS CNT FROM " & strTablePrefix & "TOPICS WHERE T_STATUS=1"
set rsCount = my_Conn.Execute(strSql)
if not rsCount.EOF then
intTopics=rsCount("CNT")
rsCount.Close
end if
set rsCount = Nothing
strSql = "SELECT COUNT(REPLY_ID) AS CNT FROM " & strTablePrefix & "REPLY WHERE R_STATUS=1"
set rsCount = my_Conn.Execute(strSql)
if not rsCount.EOF then
intReplies=rsCount("CNT")
rsCount.Close
end if
set rsCount = Nothing
' ## Sum of (Topics and Replies) to get total active posts
intMessages = intTopics+intReplies
' ## Detect presence of active users table and total active users online
if TableExists(strTablePrefix & "ACTIVE_USERS") then
' ## Table exists, get count
strSql = "SELECT COUNT(MEMBER_ID) AS CNT FROM " & strTablePrefix & "ACTIVE_USERS WHERE MEMBER_ID > 0"
set rsCount = my_Conn.Execute(strSql)
if not rsCount.EOF then
intActiveMembers=rsCount("CNT")
rsCount.Close
end if
set rsCount = Nothing
strSql = "SELECT COUNT(MEMBER_ID) AS CNT FROM " & strTablePrefix & "ACTIVE_USERS WHERE MEMBER_ID < 1"
set rsCount = my_Conn.Execute(strSql)
if not rsCount.EOF then
intGuests=rsCount("CNT")
rsCount.Close
end if
set rsCount = Nothing
end if
' ## Detect presence of auction table and total active auction items
if TableExists(strTablePrefix & "AUCTIONITEMS") then
' ## Table exists, get count
strSql = "SELECT COUNT(AUCTIONID) AS CNT FROM " & strTablePrefix & "AUCTIONITEMS WHERE ENDDATE > '" & DateToStr(strForumTimeAdjust) & "'"
set rsCount = my_Conn.Execute(strSql)
if not rsCount.EOF then
intAuctionItems=rsCount("CNT")
rsCount.Close
end if
set rsCount = Nothing
end if
' ## Detect presence of polls table and total polls
if TableExists(strTablePrefix & "POLLS") then
' ## Table exists, get count
strSql = "SELECT COUNT(POLL_ID) AS CNT FROM " & strTablePrefix & "POLLS"
set rsCount = my_Conn.Execute(strSql)
if not rsCount.EOF then
intPolls=rsCount("CNT")
rsCount.Close
end if
set rsCount = Nothing
end if
' ## Detect presence of quiz table and total quizzes
if TableExists(strTablePrefix & "QUIZ") then
' ## Table exists, get count
strSql = "SELECT COUNT(QUIZ_ID) AS CNT FROM " & strTablePrefix & "QUIZ WHERE Q_STATUS=1"
set rsCount = my_Conn.Execute(strSql)
if not rsCount.EOF then
intQuizzes=rsCount("CNT")
rsCount.Close
end if
set rsCount = Nothing
end if
' ## Detect presence of recipe table and total recipes
if TableExists(strTablePrefix & "RECIPE") then
' ## Table exists, get count
strSql = "SELECT COUNT(RECIPE_ID) AS CNT FROM " & strTablePrefix & "RECIPE"
set rsCount = my_Conn.Execute(strSql)
if not rsCount.EOF then
intRecipes=rsCount("CNT")
rsCount.Close
end if
set rsCount = Nothing
end if
' ## Detect presence of album table and total photos
if TableExists(strTablePrefix & "ALBUM") then
' ## Table exists, get count
strSql = "SELECT COUNT(PHOTO_ID) AS CNT FROM " & strTablePrefix & "ALBUM WHERE PHOTO_STATUS=1"
set rsCount = my_Conn.Execute(strSql)
if not rsCount.EOF then
intPhotos=rsCount("CNT")
rsCount.Close
end if
set rsCount = Nothing
end if
' ## List of counts collected:
' ##
' ## intMembers = Total members
' ## intTopics = Total active (or moderated) topics
' ## intForumTopics = Total active (or moderated) topics in a specified forum
' ## intReplies = Total active (or moderated) replies
' ## intMessages = Total active (or moderated) topics + replies
' ## intActiveMembers= Total active members signed in
' ## intGuests = Total guests online
' ## intAuctionItems = Total active auction items
' ## intPolls = Total polls
' ## intQuizzes = Total quizzes
' ## intRecipes = Total recipes
' ## intPhotos = Total shared photos in albums
' ##
' ## To display values using html, include them within < % and % > (delete spaces), thus:
' ## Total Members Online: < %intMembers% > (delete spaces)
' ##
' ## To display values using asp, follow this example:
' ## Response.Write "Total Members Online: " & intMembers
' ##
' ## To obtain quantity of topics in any given forum, use:
' ## Call TopicsInForum(1) - where "1" = Forum ID number
my_Conn.Close
set my_Conn = Nothing
Sub TopicsInForum(intForumID)
' ## Total Topics in a Particular Forum
intForumTopics = 0
strSql = "SELECT COUNT(TOPIC_ID) AS CNT FROM " & strTablePrefix & "TOPICS WHERE T_STATUS=1 AND FORUM_ID=" & intForumID
set rsCount = my_Conn.Execute(strSql)
if not rsCount.EOF then
intForumTopics=rsCount("CNT")
rsCount.Close
end if
set rsCount = Nothing
End Sub
Function TableExists(tabletoFind)
TableExists = False
set adoxConn = CreateObject("ADOX.Catalog")
set adodbConn = Server.CreateObject("ADODB.Connection")
adodbConn.open(strConnString)
adoxConn.activeConnection = adodbConn
isthere = false
for each table in adoxConn.tables
if lcase(table.name) = lcase(tabletoFind) then
isthere = true
exit for
end if
next
adodbConn.close
set adodbConn = nothing
set adoxConn = nothing
if isthere then TableExists = True
End Function
%>