How can you count page views or members online? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: How can you count page views or members online? (/showthread.php?tid=9788) |
How can you count page views or members online? - El Forum - 07-08-2008 [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 Many thanks, Mark How can you count page views or members online? - El Forum - 07-08-2008 [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... How can you count page views or members online? - El Forum - 07-09-2008 [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? |