Hello, I use the following tricks.
For simple (non-unique, not logged-in) online users number, you can use the following trick: 1. create global variable (yes, I know, it is FOOO), initialize it with 0. Protect this variable with boost::mutex. 2. increase it in the constructor of your application class 3. decrease it in destructor of your application class If you want the number of unique users... Let me identify users by the following string: IP + UA, where IP is IP-address, UA is User-Agent and "+" is string concatenation. You can get both of IP and UA from WEnvironment. Create global map<string, int>, protected by a mutex. Key of this map is IP + UA and value is the number of sessions sharing this identifier (probably they all are managed by single user). Increase this value in constructor of the application class, decrease it in the destructor. Delete key from the map if the value is 0 (.erase(key)). So size of this map (.size()) is actually the number of users online. For logged-in users you can use the same approach, but use username as key instead of IP + UA. Best regards, Boris Nagaev On Fri, Nov 21, 2014 at 3:30 PM, Jeffrey Scott Flesher Gmail <jeffrey.scott.fles...@gmail.com> wrote: > How do you return the number of users online, I need this for a users online > feature, also they need to be unique, and is there a way to find their users > name if they are logged in? > > Thanks > > ------------------------------------------------------------------------------ > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server > from Actuate! Instantly Supercharge Your Business Reports and Dashboards > with Interactivity, Sharing, Native Excel Exports, App Integration & more > Get technology previously reserved for billion-dollar corporations, FREE > http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk > _______________________________________________ > witty-interest mailing list > witty-interest@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/witty-interest > ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk _______________________________________________ witty-interest mailing list witty-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/witty-interest