Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   Use a page counter with asp (http://www.velocityreviews.com/forums/t792365-use-a-page-counter-with-asp.html)

Krechting 12-30-2003 04:24 PM

Use a page counter with asp
 
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

Ray at 12-30-2003 04:50 PM

Re: Use a page counter with asp
 
If you search Google, you will find a number of page counter solutions for
ASP. You can use a component, store hits in a DB, use a file that increases
in size with each visit, or probably something else. Once you get the
number, you can build your image by having 10 gif images, 0.gif, 1.gif, etc.
And then you use the value of your count to determine which images to
display in your page.

Page counters are so 90s though! :P

Ray at work

"Krechting" <m.krechting@chello.nl> wrote in message
news:a71c776d.0312300824.3fd24434@posting.google.c om...
> 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




Curt_C [MVP] 12-30-2003 04:50 PM

Re: Use a page counter with asp
 
just store the count in db.
Increment by 1 each hit.
Then just parse the count, replacing each digit with the individual
graphic/image.

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com


"Krechting" <m.krechting@chello.nl> wrote in message
news:a71c776d.0312300824.3fd24434@posting.google.c om...
> 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




Brynn 01-03-2004 04:44 AM

Re: Use a page counter with asp
 
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.krechting@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




All times are GMT. The time now is 12:49 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.