Sinisterly
Tutorial Unique Page Views - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: PHP (https://sinister.ly/Forum-PHP)
+--- Thread: Tutorial Unique Page Views (/Thread-Tutorial-Unique-Page-Views)

Pages: 1 2


RE: Unique Page Views - chunky - 07-27-2020

First of all thanks for sharing.
You should add some data about the browser to your hash to make it more unique in case multiple people use the same network.
This stackoverflow answer might be interesting for you as well.

Storing that info in a database instead of a .txt file and using the identical operator would be more efficiently btw.
PHP Code:
if(strpos($ipget, $printip) === false){   fwrite($ipfile, $printip);   $countipfile++; }

And you should definitely make use of case styles to make your variables easier to read.
Code:
camelCase PascalCase snake_case kebab-case

Using OOP would also be useful if you want people to use your stuff.


RE: Unique Page Views - MrMachoMan - 03-30-2021

Thanks! Just intergrated this into my website Smile