You know how some websites have counters or “views” for their multimedia stuff? What’s an efficient way, using PHP (and/or jQuery!), of counting views per said page such as page.php?id=2?
I don’t want to do it the traditionally way because then anyone can just refresh the browser over and over and over…
There isn’t a hard and fast way to ensure you are counting unique visitors, but you can save a list of remote addresses to a database and only count individual IP’s once (or save and increment their individual views.) This can be accomplished using the
$_SERVER['REMOTE_ADDR']key in the server superglobal. This isn’t true unique visitors for obvious reasons (dynamic IPs, proxy connections etc) but it is close enough for general public use.