Reputation: 643
I am currently building web app in PHP where the client wants to have logged in users. There will be hierarchy so the new users won't have priviliges as higher positioned users. The priviliged users will be able to post articles and files for users to see.
This is my question: How can adminisitrator or the privileged user check who viewed the article or downloaded the files. Is this possible via PHP?
Upvotes: 3
Views: 1346
Reputation: 9190
Assuming you have a table named Article
, you can store a variable in that table, lets say nr_of_views
. Each time a user views an article/page, take the id of the article and increment the nr_of_views
variable. Something like that.
Upvotes: 0
Reputation: 268462
Of course it's possible, but you won't get it out of the box most likely. You'll need to store the access history for any given user server-side. You could do this by simply storing user ids, urls, and times in a seperate table in your database. Something along the lines of:
5 | '/filedownload.php?file=cake-instructions.php' | 2012-02-15 08:23:11
8 | '/company-information' | 2012-02-15 08:15:01
Anytime a user accesses a url, you store their id, that url, and the current time in a database. This would then be readily accessible to administrators if they want to perform queries to see who viewed what, and when.
Upvotes: 1