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 =)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.