Jump to content

How do I make a "semi-unique" hit counter in PHP?


obay

Recommended Posts

Let me explain. I put something like

 

addToCounter();

 

in my INDEX page. Problem is, counter increments each time the same visitor opens/refreshes the index page. What aproach should I use so that if a visitor opens the index page, browses the site, and goes back to index page, it doesn't count anymore. But when he closes browser/goes to another site, then goes back to my site (index page), it counts again. I've tried sessions in the index page

 

if (!isset($_SESSION["loggedIn"])... {
     $_SESSION["loggedIn"] = true;
     addToCounter();
}

 

but doesn't work (or am i doing it wrong?).

 

Any help appreciated. Thanks =)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.