Home
The Toolkit for Online Communities
17707 Community Members, 0 members online, 2348 visitors today
Log In Register
OpenACS Home : Forums : OpenACS Development : Get number of visitors currently browsing the site : One Message

Forum OpenACS Development: Re: Get number of visitors currently browsing the site

Collapse
Posted by Lars Pind on
Yes, IP is unreliable. Any better suggestions?

Session_id, maybe?

/Lars

Collapse
Posted by Bruno Mattarollo on

I guess that the problem with session_id is that it will also count the spiders, etc (I mean, everything accessing the site).

Something like:

set ten_min_ago [expr [ns_time] - (10*60)]
set sql_query "select count(distinct session_id) 
    as result from sec_session_properties where last_hit > :ten_min_ago"
db_1row select_sessions $sql_query
should give you some sessions. The only issue that I see is that, at least in OpenACS 4.6.3 (that's what we are using at the moment) you don't have an index on sec_session_properties(last_hit) so this query is quite inefficient (but I am not sure than adding an index is also a good solution, this table is touched a lot -for every hit, right?-).

Just my 2 cents,

/B

Collapse
Posted by Jade Rubick on
Perhaps we could cache the results every minute, and average them or something? The number doesn't have to be 100% accurate, but it should give a general idea of how many people are using the site.
Collapse
Posted by Joel Aufrecht on
I tried Bruno's query and find that I get 0 sessions even if there is an active member session.