Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 30 Days Stats Code
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

bengriffiths
New Member

United Kingdom
51 Posts

Posted - 27 February 2003 :  07:42:35  Show Profile  Visit bengriffiths's Homepage
OK, fiddled around a bit with it, and here's a simple Show Posts for Last 30 Days code with average at the bottom.

I'm sure I could do the date routines a bit better, but on my forum at least it works

Enjoy....


<%
'#################################################################################
'## Copyright (C) 2000-02 Michael Anderson, Pierre Gorissen,
'##                       Huw Reddick and Richard Kinser
'##
'## 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.
'##
'## All copyright notices regarding Snitz Forums 2000
'## must remain intact in the scripts and in the outputted HTML
'## 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 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.
'##
'## Support can be obtained from support forums at:
'## http://forum.snitz.com
'##
'## Correspondence and Marketing Questions can be sent to:
'## reinhold@bigfoot.com
'##
'## or
'##
'## Snitz Communications
'## C/O: Michael Anderson
'## PO Box 200
'## Harpswell, ME 04079
'#################################################################################

'########### Post Stats Code by Ben Griffiths (ben@bengriffiths.co.uk) ###########
%>
<!--#INCLUDE FILE="config.asp"-->
<!--#INCLUDE FILE="inc_sha256.asp"-->
<!--#INCLUDE FILE="inc_header.asp" -->
<% 

	function FormatDate
		If Year(Date)<2000 then
			FormatDate = "20" & Year(strForumTimeAdjust) & "/" & Month(strForumTimeAdjust) & "/" & Day(strForumTimeAdjust)
		else
			FormatDate = Year(strForumTimeAdjust) & "/" & Month(strForumTimeAdjust) & "/" & Day(strForumTimeAdjust)
		End If
	end function

	Response.Write	"<table border=""0"" width=""100%"" align=""center"">" & vbNewLine & _
			"  <tr>" & vbNewLine & _
			"    <td width=""33%"" align=""left"" nowrap><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
			"    " & getCurrentIcon(strIconFolderOpen,"","align=""absmiddle""") & " <a href=""default.asp"">All Forums</a><br>" & vbNewLine & _
			"    " & getCurrentIcon(strIconBar,"","") & getCurrentIcon(strIconStats,"","align=""absmiddle""") & " <a href=""stats.asp"">Statistics for last 30 Days</a></font></td>" & vbNewLine & _
			"  </tr>" & vbNewLine & _
			"</table>" & vbNewLine


	response.write 	"<center>" & VBNewLine & _
			"<table bgcolor=""" & strTableBorderColor & """ border=""0"" cellpadding=""2"" border=""0"" cellspacing=""1"" width=""300"">" & VBNewLine & _
			"<tr bgcolor=""" & strHeadCellColor & """><td align=center><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHeadFontColor & """><b>Date</b></font></td><td align=center><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHeadFontColor & """><b>Amount Posts</b></font></td></tr>" & VBNewLine

	DaysBack=0
	BgColor=1

	TotalPosts=0

	Set Conntemp=Server.CreateObject("ADODB.Connection")
	Conntemp.Open my_Conn

	For t=1 to 30

		If BGColor=1 then
			BGColor=0
			BGString=strAltForumCellColor
		else
			BGColor=1
			BGString=strForumCellColor
		end if

		HiDate = DateToStr(DateAdd("d",DaysBack+1, FormatDate() & " 00:00:00"))
		LoDate = DateToStr(DateAdd("d",DaysBack, FormatDate() & " 00:00:00"))

		strSql = "SELECT SUM(PostCount) AS FullCount FROM (" & "SELECT COUNT (*) As PostCount FROM " & strTablePrefix & "TOPICS WHERE (T_DATE >= '" & LoDate & "' AND T_DATE < '" & HiDate & "')" & " UNION " & "SELECT COUNT (*) As PostCount FROM " & strTablePrefix & "REPLY WHERE (R_DATE >= '" & LoDate & "' AND R_DATE < '" & HiDate & "')" & ") As MyView;"

		Set db_TOTAL=Conntemp.Execute(strSql)

		Response.write "<tr><td align=center bgcolor=" & BGString & "><font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & FormatDateTime(DateAdd("d",DaysBack,FormatDate() & " 00:00:00"),2) & "</font></td><td align=center bgcolor=" & BGString & "><font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & db_TOTAL("FullCount") & "</font></td></tr>"

		DaysBack=DaysBack-1
		TotalPosts=TotalPosts+(db_TOTAL("FullCount"))

	Next

	response.write "</table>" & vbNewLine &_
			"<br>" & vbNewLine &_
			"<center><font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><b>Average Posts Per Day: </b>" & int(TotalPosts / 30) & "</font></center>"

	Conntemp.close
	set Conntemp = nothing
	set db_TOTAL = nothing

	WriteFooter
	Response.End
%>


ben

http://www.fiatforum.com

Edited by - bengriffiths on 28 February 2003 05:24:13

Image
Average Member

Canada
574 Posts

Posted - 27 February 2003 :  21:36:58  Show Profile  Visit Image's Homepage  Send Image an ICQ Message
Microsoft VBScript runtime error '800a000d'
Type mismatch: '[string: "2/28/2003 300:00:00"]'

/demo/test.asp, line 85
Go to Top of Page

bengriffiths
New Member

United Kingdom
51 Posts

Posted - 28 February 2003 :  05:24:34  Show Profile  Visit bengriffiths's Homepage
hmmm... ok, changed the way dates work, try it now (code above edited)

ben

http://www.fiatforum.com
Go to Top of Page

Etymon
Advanced Member

United States
2385 Posts

Posted - 01 March 2003 :  00:45:49  Show Profile  Visit Etymon's Homepage

Very nice site, Ben!

I drove an X 1/9 for a bit over 5 years. It was loads of fun! My wife swears that one day dhe'll get me another. LOL!

Thanks for the post.

Etymon
Go to Top of Page

bengriffiths
New Member

United Kingdom
51 Posts

Posted - 03 March 2003 :  18:07:56  Show Profile  Visit bengriffiths's Homepage
Thanks very much If you ever get it, make sure you join up!

ben

http://www.fiatforum.com
Go to Top of Page

aecio
Junior Member

Brazil
120 Posts

Posted - 16 July 2003 :  02:45:17  Show Profile  Visit aecio's Homepage
Why don't I have the inc_sha256.asp file included in line 43? Is this a mod file?

Cheers!

Visit the Healthy Planet online support community:
http://healthyplanet.xsaude.com.br/
Go to Top of Page

Webguy
New Member

Australia
65 Posts

Posted - 22 July 2003 :  10:40:43  Show Profile  Send Webguy an ICQ Message
I'm getting an error here...

Set Conntemp=Server.CreateObject("ADODB.Connection")
Conntemp.Open my_Conn <---------------

I run my forums with MYSQL, is there a change required for this?

Cheers

"Special bulletin: There is still no news from New Zealand. If they ever have any, we'll be sure to let you know."
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.22 seconds. Powered By: Snitz Forums 2000 Version 3.4.07