[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] File change



Subject: RE: [cobalt-users] File change


> > I don't know this has anything to do with a RaQ4, but seeing as the
> > script is running on one, I'll ask the question.
> >
> > I have a counter which runs from a cgi script, which increments a text
> > file when the website is accessed.  The text file translates to the
> > numbers which appear on the site.
> >
> > Every so often, the text file seems to be set back to zero - yesterday
> > the counter on the site read 121729, today it read 167.  I edit it to
> > reflect the number it should be reading then a week or two later it is
> > set back to zero.
> >
> > Any ideas please?
> >
> > Thanks
> >
> > Regards
> >
> > Jackie
>
> The obvious question is at what point does the counter naturally roll over
> to zero.
> Quite a few of these counter scripts increment for every part of the page
> that loads, so every graphic on the page increments it. It's the
difference
> between hits and unique visitors. i.e. if you have 100 little graphics it
> increments by 101, once for the page and again for each graphic.
>
> Phil
>
Make sure the CGI controled file can lock.
Example: lock
open(CDB, ">$client_db");
flock(CDB, 2);
print CDB "$\n";
flock(CDB, 8);
close(CDB);

Example no lock:
open(CDB, ">$client_db");
print CDB "$\n";
close(CDB);

  David Hahn
  PageKeeper Service
  http://www.pagekeeperservice.com