obay Posted June 19, 2007 Share Posted June 19, 2007 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 =) Quote Link to comment https://forums.phpfreaks.com/topic/56160-how-do-i-make-a-semi-unique-hit-counter-in-php/ Share on other sites More sharing options...
only one Posted June 19, 2007 Share Posted June 19, 2007 you dont need the isset function if your going to set your variable to true or false if (!$_SESSION["loggedIn"]){ $_SESSION["loggedIn"] = true; addToCounter(); } Quote Link to comment https://forums.phpfreaks.com/topic/56160-how-do-i-make-a-semi-unique-hit-counter-in-php/#findComment-277452 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.