473,396 Members | 1,927 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.

Visit Counter II

The code below works as a page counter for me, counting how many visits my
web site has per week (Sunday - Saturday). This works fine - it write the
date and the count to a text file e.g.

15/8/2008
1001

When the new week arrives the old information is just overwritten, however
what I would like to do is keep the old information but starting the new
week with two new lines appended to the top of the existing information so
maintaining the historical data.

or

I actually can write the code that appends the two new lines when the new
week starts. However I do not have sufficient knowledge to be able to write
the ASP required to either amend the top two lines of the textstream (for
when the total should be added).

Any help or references gratefully received.

PWS

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~
strCountFileName = Server.MapPath(Request.ServerVariables("SCRIPT_NAM E") &
".cnt")

Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

Set objCountFile = objFSO.OpenTextFile(strCountFileName, 1, True)

If Not objCountFile.AtEndOfStream Then
dtDate = CDate(objCountFile.ReadLine)
iCount = CLng(objCountFile.ReadLine)
Else
dtDate = Date
iCount = 0
End If

objCountFile.Close
Set objCountFile = Nothing

If IsEmpty(Session("TotalCount")) Then

If Weekday(Date(),vbSunday) = 1 And dtDate <Date then
iCount = 1
Else
iCount = iCount + 1
End If
dtDate = Date

End If

Session("TotalCount")= iCount

Set objCountFile = objFSO.CreateTextFile(strCountFileName, True)

objCountFile.WriteLine dtDate

objCountFile.WriteLine iCount

objCountFile.Close
Set objCountFile = Nothing

Set objFSO = Nothing

Response.Write iCount
Aug 28 '08 #1
0 1056

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

Similar topics

4
by: Shane | last post by:
:) I am following a tutorial for php (hudzilla.org) absolutely loving it however I am having trouble with the counter example <?php // your content here... $filename = 'counter.txt'; // our...
16
by: Paul Rubin | last post by:
I'd like to have a function (or other callable object) that returns 0, 1, 2, etc. on repeated calls. That is: print f() # prints 0 print f() # prints 1 print f() # prints 2 # etc. ...
11
by: TomCat | last post by:
Hello, can anyone send me a link or even some sample of script that counts visits to a website ? Thanks, TomCat
0
by: Earl Anderson | last post by:
KB Article Q140908 provided the following function to create an Auto Incrementing Counter: Function Next_Custom_Counter () On Error GoTo Next_Custom_Counter_Err Dim MyDB As Database Dim...
6
by: Deep Shrestha | last post by:
I have face the problem in page counter, as when i link with another page, the counter itself increases which is impossible. Please i hope u will help me as soon as possible... Best Regards...
0
by: Trevor L. | last post by:
I decide to put a custom Hit Counter on my page (below). Then I won't be reliant on the standard FrontPage one which uses webbots. It is called by <b>Hit Counter: </b><!--#include...
5
by: jasonchan | last post by:
How would you set up a counter in javascript that goes from 5 to 0 This is what i have so far and it is not displaying in the div container "counter" for some reason... <!DOCTYPE html PUBLIC...
3
by: josecruz | last post by:
I am deveoloping a database where I will record a Pet general information. Then I want to monitor every visit and other variables. I have created the tables Pet_info, Pet_Visit, Pet_medication etc. ...
2
by: gumbercules | last post by:
I am designing a site that is regulary updated with new podcasts. I would like to be able to have a counter next to each podcast showing how many hits/listens/plays/views each particular podcast has...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.