Currently I have a file called \"hits.php\" and on any page I want to track page hits I just use
How can I track u
I found the solution of very poor quality and just a quick and dirty way of doing it.
I too was developing something similar and formulated a quick method which works without redundancy.
I needed a counter for every time someone accessed another user's profile.
Pseudo:
This will deny the same person accessing the same user profile to add 1 to the counter on refresh for the whole day (or 12 hours) whereas the above solution by Glenn Nelson would indeed add 1 to the counter, but deny adding to every user's counter at the same time.
Not only this, but if you were to logoff and log back in to the website, then it would simply re-add to the counter in which some cases trolls and haxorz wannabe's will exploit this (as the session is destroyed and started again).
Here are my sample tables:
users
{
user_id INT(8) auto increment, user_name varchar(32), user_counter INT(12)
};
daily_views
{
view_id INT(8) auto increment, viewer_name VARCHAR(32), viewee_name VARCHAR(32)
};
Here is sample code I've written: