PHP: ipcheck

sameIP() is my most important function in Power Phlogger. Phlogger calls that
function every time someone enters a page. Actually, that’s all it does: sameIP()
returns true if the visitor was already logged and doesn’t
need to be tracked again. I’m checking his IP and keep it for the last $timeout
minutes (as default I use 30 minutes). If it’s a new visitor or his timeout has
expired, the function returns false and I create a new hit.

To make sure noone gets counted twice, I keep all IP’s of current online users.
here’s a sample how to call that function:

ipcheck_file.php: (WARNING: this function requires a writable text-file, $ipfile)

…then I started to get into mySQL, what makes that thing much easier. Use this
function if you got access to a mySQL database.
Here’s my table-definition:


Comments are closed