separator

Take a quiz or make one of your own
Tutorial 4 - Web Hit Counter Override Using a Cookie
What It's All About

In the previous tutorial we wrote a Perl program to implement page view counting for a website. If you have implemented counting for your site you might be realizing that it counts hits that even include you, the owner of the site.

But wait! How can I count only the hits made by visitors other than myself? My program doesn't know that it's me rather than someone else visiting. How can it? One magic word, cookies.

A cookie is a small bit of information saved on a client machine. For example, on my wintel machine the Netscape browser has set up a file at C:\Program Files\Netscape\Navigator\cookies.txt. Why not fire up your favorite text editor now and find your cookies file?

Interesting what's in there, isn't it? If you're using Internet Explorer, you should look for a cookies folder which contains individual files for each cookie. On my machine the folder is at C:\WINDOWS\Cookies\. For those using Opera as their browser, the cookies are in c:\Program Files\Opera\cookies.dat.

separator

© www.thecgibin.com