473,396 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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
Jul 19 '05 #1
3 2344
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.*********@chello.nl> wrote in message
news:a7**************************@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

Jul 19 '05 #2
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.*********@chello.nl> wrote in message
news:a7**************************@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

Jul 19 '05 #3
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


Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
1
by: Andrew | last post by:
I am looking for a simple JavaScript program that would redirect users to one of two web pages based on the web page counter. For example, when the counter is odd, the user would be redirected to...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
1
by: vj | last post by:
How i can populate all fileds dynamically in jsp page based on contents found in xml file? I have written jsp servlets and java class file. i transferred automatic data from jsp to servlet then to...
0
by: vijendra | last post by:
How i can populate all fileds dynamically in jsp page based on contents found in xml file?I have written jsp servlets and java class file. i transferred automatic data from jsp to servlet then to...
0
by: George2 | last post by:
Hello everyone, I am not sure whether I am wrong or the Windows Internals Book 4th version is wrong. Here is what the book says in Chapter 7, Memory Management from Page 444 to Page 445 ...
9
by: Suman | last post by:
Hi All, I am trying to experiment with sessions and they seem to be resetting everytime i visit the page. here is the code of the page <?php session_start(); $count = $_SESSION + 1;
4
by: Stefan Mueller | last post by:
Hallo I'm looking for a solution to display on a web page each second a new line. Unfortunately does the following solution not work with the Internet Explorer: ...
30
by: Paul W Smith | last post by:
I have written a hit counter, which I believe counts the times my page is hit by a user for each unique session by the user. The relevant part of my code is below: If...
2
by: qwedster | last post by:
Folks! The following is a "Hello World" kind of code for ViewState. I just want to know how to retain the ViewState 1) while Page Refresh when using UpdatePanel and also 2) While I reverting back...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.