List of users ins ASP-Site

H

Hollek

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
 
R

Rob Meade

...
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top