Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / October 2005



Tip: Looking for answers? Try searching our database.

how to show the user is online and logged in?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
HongKongSunny - 28 Oct 2005 05:27 GMT
i am making a community page, in the member browsing page, i want to show the
surfer that whether the user is  online and logged in, i am using  
#Session.Memberid# to memorized the member's id, can anyone help me?
ScottyMTL - 29 Oct 2005 14:51 GMT
Two ways...

Open up the new CFMX7 documentation and look at Application.cfc chapter, you
will see all you need to do that kind of thing.

Otherwise, in the good old time I had to build an application level array of
structures containing my users data (id, name, lastactivitytime).  I
established my timeout to be, say, 15 minutes.  On each request from a user I
update his lastactivitytime... then I look at all the users in this array to
delete each entry with a lastactivitytime greater than 15 min from now.  This
is a patch...

Another more precise method... you could also put an "hidden" iframe of 1px
(0px or style hidden won't work in NS, so 1 px is good) on each page and put a
meta refresh of, say, 30 seconds... so that each 30 seconds the page in the
iframe, sessiontracker.cfm would refresh this user activityTime in Application
scope.  For even more fun you could have this cfm page return the list of users
logged in and use it to refresh the innerHTML of your DIV showing that list (in
the main page, not the iframe page)... dynamically.  Easy enough in JS.

So, you have 3 ways of doing it.  Application.cfc is the more precise... the
last one is the coolest.
ScottyMTL - 29 Oct 2005 23:33 GMT
Forgot... you can also run a scheduled task each so many minutes to check "expired" sessions instead of just counting on each user request.  But the best way remains using Application.cfc
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.