• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can you count page views or members online?

#1
[eluser]markanderson993[/eluser]
Well, I hope this question has a simple solution but I fear it may not. Here goes then. How can you retrieve the names of the members viewing a certain page (like this forum which displays members viewing a specific page)? Also, how can you count the number of times a page has been accessed? (like seeing the numbers hits on a forum thread)

Any help would be greatly appreciated. This topic seems like some sort of taboo subject and I just wish there was some sort of brave soul out there that could shed some light Smile

Many thanks,
Mark

#2
[eluser]Eric Cope[/eluser]
The page view counts is easy. In the controller of a page, insert the code to get a value from a database, increment it, and update that value in the same database.

To display names, you would need to interface with the sessions database. In your controller, write a value to a database every page load. Check first if the values in the user list are still active in the sessions table, if not, clean the user list table.

It sounds like a pain the butt, but possible...

#3
[eluser]markanderson993[/eluser]
Thanks for the useful info. So just to get this straight, if I wanted to display the names of the users viewing a certain page, I would need to first send the name of the page as a Session variable to to the database. Then if the database finds the session name I would display the users name, else clear the session variable?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.