[PHP] Logging visitors

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,638
2,393
Ok, I know you can use Google Analytics for stuff like this. But say I wanted to find out locally how many people had visited my website, what method would you use?

I know possibly the most obvious one would be to log IP addresses, but say if 3 people from the same IP access the site, only 1 would be logged (depending on how you code the system).

How would you go about doing it?
 

Kaz

BooYah
Staff member
Nov 16, 2010
3,064
1,025
If you had multiple visitors from the IP, you could possibly log $_SERVER['HTTP_USER_AGENT'] meaning you would know if they use the same pc and/or multiple devices.
Also a timestamp may help to identify when they visited?
 

Ecko

23:37 [autobots] -!- eckostylez [[email protected]]
Nov 25, 2012
1,398
962
The web server's log file. Apache's access log will record the RFC1413 of the client thanks to the standardizing of the CLF. Two users can have the same IP, but they will most likely not share the same ident.
 

Users who are viewing this thread

Top