Welcome Guest, Not a member yet? Register   Sign In
Showing currently online users...
#1

[eluser]codelearn[/eluser]
Has anyone here written code that will output the current amount of users on the site (in say, the last minute or so).

I thought about using sessions but they seem to be wildly inaccurate. IP's? Ideas?

Thanks!
#2

[eluser]Phil Sturgeon[/eluser]
You could use CI's db sessions and run a query on that?

Either that or do the normal

on pageload
insert userid, page, ip, date

then run a cron job every x often deleting old sessions? Could be run every 5 mins to delete all entries which should keep things FAIRLY accurate?
#3

[eluser]codelearn[/eluser]
Hmm. I don't want to run a query on sessions because Google and other advertisers are always logging sessions in the table.

I think the page load idea is the easiest. Good call.
#4

[eluser]Imkow@CN[/eluser]
im about to add that to my app. i used to write it without ci.
it's just going to need one table in db to trace the online users. you can even setup the table on pure memery, for the fastest responding time.




Theme © iAndrew 2016 - Forum software by © MyBB