Mikael wrote:
Hi all,
I would like to display all logged in member on my webpage.
example
3 Inlogged members :
adam
cesar
Mike
...
...
..
How do i do this best? Can you give me some hints? session collection
or...? I use a global.asa. Give me some example if u can.
Regards Mikael
This will not be perfect, given the fact that the server does not know when
users close their browsers, but it may server your purpose. In global.asa,
do this:
sub session_onstart
dim arUsers, sUser, i, bFound
sUser = request.servervariables("LOGON_USER")
session("user") = sUser
application.lock
arUsers = application("arUsers")
if Not isArray(arUsers) then
redim arUsers(0)
arUsers(0) = sUser
else
bFound = false
for i = 0 to Ubound(arUsers)
if arUsers(i) = "" then
arUsers(i) = sUser
bFound = true
exit for
end if
next
if not bFound then
redim preserve arUsers(ubound(arUsers)+1)
arUsers(ubound(arUsers)) = sUser
end if
end if
application("arUsers") = arUsers
application_unlock
end sub
sub session_onend
dim arUsers, i
sUser = session("user")
application.lock
arUsers = application("arUsers")
for i = 0 to Ubound(arUsers)
if arUsers(i) = sUser then
arUsers(i) = ""
end if
next
application("arUsers") = arUsers
application.unlock
end sub
This is assuming you have anonymous access turned off. If it is on, you will
need to use another method to populate session("user")
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"