Click to See Complete Forum and Search --> : counter.cgi question


charlieb
02-11-2003, 09:41 AM
Hi folks,

I'm trying to install the counter.cgi I downloaded here -- it looks like just what I'm searching for. I've got it working *almost*, but I'm running into a problem I can't find addressed in the article.

The first time I visit the site where I've added the HTML code to link to the .cgi file, it seems to work fine, displaying the counter at the bottom of the page and apparently interacting with my count file (which I've called "tester".)

However, when I visit the site a *second* time to see if it will increment properly, there's a hesitation, then the counter gets bumped back to zero and there's an "Errors on page" message at the bottom of my browser. Then when I check my /count directory, I see that a new "lock" file has been added, in this case, "tester.lock."

I re-read Joe's discussion about how I can create .lock files to keep out those trying to use the counter without permission, but did I miss something? -- there's nothing that I found about the system automatically generating a .lock file on the second visit.

What am I doing wrong?

thx much, charlie

jeffmott
02-11-2003, 01:29 PM
Creating .lock files is the script's way of attaining an exclusive lock on the file so multiple processes don't try to write to it at the same time (although creating .lock files is an example of how NOT to accomplish this). It sounds as if the script does not release the lock when it is done with the file so it can't access the file after the first running. My suggestion is to find a different script. Joe Burns has not been known for doing things correctly. A counter is one of the easiest scripts to find on the net.