1 Reply Latest reply on Apr 29, 2007 9:22 AM by craigkaminsky

    User management

    Irish-Phoenix Level 1
      I have a section in my web site that you need to log into. I am trying to create a tag that tells you, when you log in on the page that you log onto, what users are online. Like this:

      Phoenix is logged in

      How do I do this?
      I need it to also disengae once the user logs out.

      Can anyone help me out?
      Thank you.

        • 1. Re: User management
          craigkaminsky Level 3
          Off-hand, I can envision one (probably old-schoolish) approach:
          Hold the user's online/offline status in the database table you use to manage their accounts.
          When a user logs in, tick their record in the database to indicate they are online (isOnline=1).
          When the user logs out, change the value back to "off" (isOnline=0). You could also (depending on what version of CFMX you have the approach would be different) set this value to change automatically when the session ends/times out (see OnSessionEnd -- http://livedocs.adobe.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?cont ext=ColdFusion_Documentation&file=00000701.htm).

          To display who's online, you could employ some fairly basic Ajax code to call a CFM template, query who's on and return the data to the Ajax script, which would output the data to the screen (too much code to type here for an example, but check out: http://www.w3schools.com/ajax/default.asp for some basic tutorials (apologies if this is below your skills...not sure what you may/may not know about Ajax but wanted to include it just in case). Also, check out ajaxCFC for implementing Ajax in CF apps faster ( http://ajaxcfc.riaforge.org/).

          One other thing I'd be interested in hearing about (if it applies) is how event gateways in CFMX 7 might be able to help here. Event gateways are on my list of things to learn still and might not apply here but I'd be interested to know if they did.

          Anyway, hope this helps get you started...