Solved

Tracking Visits to my Web Site

Posted on 1997-06-24
2
191 Views
Last Modified: 2013-12-25
A) The current web site I am working on I created using Microsoft Visual Interdev

B) the problem > I track the number of visits to the web site in a text file.  I use the Session_OnStart routine in global.asa via VBSCRIPT.

The process is to 1) load the text file in to get the count, 2) close that file, 3) re-create the file writing the new total of visits.

Finally, my question> What happens if two people access the file at the same time?  How can I protect from any possible file problems?
0
Comment
Question by:MLHAMMEL
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
icd earned 30 total points
ID: 1828532
If two people access at the 'same time' then the worst that can happen is that one visit will not be counted. Imagine the counter having the value 100

Visitor A opens the file, reads 100
Visitor B opens the file, reads 100
Visitor A writes the value 101
Visitor B writes the value 101

With more complex data manipulations it can cause inconsitancies between dependent data which can cause your database to become corrupted.

The normal way of locking in perl is to use the 'flock' command. I have not used VBSCRIPT but there is likely to be a similar method in that language. Do a search for 'lock'. To do an update you first obtain the lock, make the read, increment it, write the file back again and then free the lock. Another process wanting to do an update will have to wait for the lock to become available.

On my own web site I don't bother with file locking in this type of case since the data is fairly inaccurate anyway. So long as it does not corrupt the data I don't mind.

0
 

Author Comment

by:MLHAMMEL
ID: 1828533
I did some research and you are right about the LOCK command.  I am using Application.Lock, Application.Unlock

Good anwser.

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Powershell GUI 11 92
Help with Progress 4gl Rounding Function 6 59
Script to move computer from one domain to another 6 53
script to read text file 34 28
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question