This is an old counter I used to use ... I made it for kicks
It uses a table in a database. The table name is zcounter
The column names are zpage and zhits
This way you can also have different pages being counted if you want.
Another thing I did is have it create a cookie for the user that
expires in a day. This will let a users computer only add to the
counter once a day ... granted, only if they have cookies on.
I also, instead of images, used the CSS at the top to control design
as to avoid images, but you could easily change that in the code.
Have fun ... I will make an updated counter script and have it on my
website sometime in the next couple weeks, just for fun :)
Brynn
www.coolpier.com (new website under construction)
<style type="text/css">
td.coolpier_counter {background-color:#F4F4F4; color:#336699;
font-size:16; font-weight:bolder;}
</style>
<%
'//CHANGE CONNECTION STRING
connString="your connection string"
Sub coolpier_counter(thePage)
'//Need a table called zcounter
'//Two fields: zpage (text), zhits (number)
Set conn=Server.CreateObject("ADODB.Connection")
conn.Open(connString)
If Request.Cookies("zhit")<>"1" Then
zsql="UPDATE zcounter SET zhits=zhits+1 WHERE
zpage='" & thePage & "';"
conn.Execute(zsql)
Response.Cookies("zhit")="1"
Response.Cookies("zhit").expires=Date()+1
End If
zsql="SELECT zhits FROM zcounter WHERE zpage='" &
thePage & "';"
Set rs=conn.Execute(zsql)
theCount=rs(0)
rs.Close: Set rs=nothing
conn.Close: Set conn=nothing
With Response
.Write "<table align=center cellpadding=3
cellspacing=1 border=0><tr>"
.Write "<td class=""coolpier_counter"">Hits: </td>"
numLength=Len(theCount)
For n=1 to Len(theCount)
.Write "<td class=""coolpier_counter""
width=15>" & Mid(theCount, n, 1) & "</td>"
Next
.Write "</tr></table>"
End With
End Sub
coolpier_counter("yourpage.asp")
%>
On 30 Dec 2003 08:24:24 -0800,
m.*********@chello.nl (Krechting)
wrote:
Hi All,
All I want is a small graphical page counter on my homepage.
I'm using an access db and want to track how many times the
pages were used (logged on to).
All the graphical counters on the internet point to a website
but my project runs on a localhost.
Regards
Marco