Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Use a page counter with asp

Reply
Thread Tools

Use a page counter with asp

 
 
Krechting
Guest
Posts: n/a
 
      12-30-2003
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
 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      12-30-2003
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!

Ray at work

"Krechting" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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



 
Reply With Quote
 
 
 
 
Curt_C [MVP]
Guest
Posts: n/a
 
      12-30-2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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



 
Reply With Quote
 
Brynn
Guest
Posts: n/a
 
      01-03-2004
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, http://www.velocityreviews.com/forums/(E-Mail Removed) (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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP Page Counter Paul W Smith ASP General 32 09-12-2008 04:48 PM
Page File counter and Private Bytes Counter George2 C++ 1 01-31-2008 09:27 AM
Session("counter") vs. ViewState("counter")...a newbie question The Eeediot ASP .Net 3 12-22-2004 09:31 PM
Page Counter Component, ASP 3.0 Roland Ramirez ASP General 3 02-02-2004 07:40 PM
ASP 3.0, Need help with Page Counter Component Roland Ramirez ASP General 1 01-30-2004 06:04 PM



Advertisments