List of users ins ASP-Site  
Author Message
werekenn





PostPosted: Thu Dec 11 02:37:47 CST 2003 Top

ASP/Active Server Pages >> List of users ins ASP-Site

Before users can use my asp-site, they have to login.
The username is stored in a session variable "USR".
I need a list of all users that are active in my site.
I tried to store the logged usernames in an application
variable when they login in the default.asp site:
Application("AktiveUser") = Application("AktiveUser")
& "<BR>" & Session(USR")
When the Session ends, the username is deleted from the
application variable like this :
Function session_OnEnd in Global.asa
Application("AktiveUser") = ReplaceString(Application
("AktiveUser"), "<BR>" & Session("usr"), "")
Problem : In this function the session variable "USR" is
empty, so the name can not be deleted.
Has anyone a better idea to get a list of active users ?
Thank you all.
Hollek

Web Programming115  
 
 
Rob





PostPosted: Thu Dec 11 02:37:47 CST 2003 Top

ASP/Active Server Pages >> List of users ins ASP-Site "Hollek" wrote ...

> Has anyone a better idea to get a list of active users ?
> Thank you all.

I wouldnt call this a 'better' idea, as I expect that the application
variables are typically people use for this however...

You could, upon login set a flag against the users details in the database
(I'm assuming you're using one here)..

You would also need to store the date/time in the database which the user
last did something - and include this update routine on each page, ie, each
time that user arrives at a page it updates the value in the database to
equal the date/time now.

Not sure what your 'inactive' time is - but I'll assume its 20 minutes - so
you'd also want to create a job that runs on the database (assuming more sql
server in my thoughts at the moment) - every 20 mins or so to check for
expired logins, this would use the above date/time field for its values -
finding any it would set the 'logged in' flag back to 'not logged in' etc..

Once this is running nicely, all you'd need to do is create perhaps a view
of the users where the logged in flag was set to true and then pull their
names out and list them on the page or whatever you want to do with them....

As I said initially I expect most people just use application variables -
but this would be an alternative..

Regards

Rob