473,323 Members | 1,551 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

I would like to display....

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
Jul 19 '05 #1
4 1781
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"
Jul 19 '05 #2
Hi Bob
Your code is a bit "hi tec" at least for me...
Im not sure it serve my purpose. But i have problem following exactly what
you are doing.
Let me explain more in detail.

My site are a place for people to meet. Dating and soo on.

1) When people get to my page they start a session..right? This is done
automatic. i dont care about
these people. They are not on any list because they are not logged in.

2) Members who are logged in to my site i whant to display on a list. Like
this:
Logged in
peter
mike
...
...
3) When my members logg in to my site i check in the database if all is ok
(username, password)
then i set session("memberId") and session("username")

But... what can i do to display all inlogged members. Do i have to use
the Application collection? How do i add people and how do i delete people
when they leve my site?

Hope u understand what im trying to say here :-)

Regards Mikael



"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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"

Jul 19 '05 #3
Mikael wrote:
Hi Bob
Your code is a bit "hi tec" at least for me...
Im not sure it serve my purpose. But i have problem following exactly
what you are doing.
Let me explain more in detail.

My site are a place for people to meet. Dating and soo on.

1) When people get to my page they start a session..right? This is
done automatic. i dont care about
these people. They are not on any list because they are not logged in.
They are going to have to be if you wnat to display their names ...

2) Members who are logged in to my site i whant to display on a list.
Like this:
Logged in
peter
mike
As you said in your first post ... ??
..
..
3) When my members logg in to my site i check in the database if all
is ok (username, password)
then i set session("memberId") and session("username")
You did not mention that you had a database. Create a table containing the
names of the users that are currently logged in. When users log in, add
their names to that table. The only problem will be to get the names out of
that table when they log out. If you have a logout page, that will take care
of most of the logouts. the problem is when they close their browsers
without using your logout page. That is where you can use the session_onend
code to remove their names from the database. The names will be in their
until the session times out, but they will be removed.

But... what can i do to display all inlogged members. Do i have to use
the Application collection?
You would if you did not have a database.
How do i add people and how do i delete
people when they leve my site?
That is what I showed in my example. Study it. You have the option of using
a database. the code I posted can be adapted to add names to a database
table instead of an application variable. That is up to you.

Hope u understand what im trying to say here :-)


Yes I did. It's not an infrequent question ...

--
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"
Jul 19 '05 #4
Hi Bob,
yes i will use my database to solve this problem. I'll get back if i run
into more
problem. Thanks for all help!
Miakel
"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:u6****************@TK2MSFTNGP09.phx.gbl...
Mikael wrote:
Hi Bob
Your code is a bit "hi tec" at least for me...
Im not sure it serve my purpose. But i have problem following exactly
what you are doing.
Let me explain more in detail.

My site are a place for people to meet. Dating and soo on.

1) When people get to my page they start a session..right? This is
done automatic. i dont care about
these people. They are not on any list because they are not logged in.
They are going to have to be if you wnat to display their names ...

2) Members who are logged in to my site i whant to display on a list.
Like this:
Logged in
peter
mike


As you said in your first post ... ??
..
..
3) When my members logg in to my site i check in the database if all
is ok (username, password)
then i set session("memberId") and session("username")


You did not mention that you had a database. Create a table containing the
names of the users that are currently logged in. When users log in, add
their names to that table. The only problem will be to get the names out

of that table when they log out. If you have a logout page, that will take care of most of the logouts. the problem is when they close their browsers
without using your logout page. That is where you can use the session_onend code to remove their names from the database. The names will be in their
until the session times out, but they will be removed.

But... what can i do to display all inlogged members. Do i have to use
the Application collection?
You would if you did not have a database.
How do i add people and how do i delete
people when they leve my site?


That is what I showed in my example. Study it. You have the option of

using a database. the code I posted can be adapted to add names to a database
table instead of an application variable. That is up to you.

Hope u understand what im trying to say here :-)


Yes I did. It's not an infrequent question ...

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

Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ismael Herrera | last post by:
Hi,i wonder if there is an editor or ide that has similar dinamic instrospection features as ipython? ,since i have failed to find one, i spend more time coding in ipython than in my editor. ...
7
by: Zhang Weiwu | last post by:
Hello. This is problem puzzled me a long time. I wish to organize some block elements and let them flow one after each other like text. Think about a album, I wish the album have 12 thumbnails,...
4
by: Shash | last post by:
Hey People, I'm facing a issue with browser compatablity here, I want a certain group of divs to behave like a table row, i.e if one of the cell/div has content longer than the other divs, all...
6
by: Daniel Jung | last post by:
Hi This is not a "CSS I want you to do for me since my boss needs it yesterday"... I am wondering about a few things, and I am still working on this, but wanted to share it with you at this...
1
by: Laszlo Nagy | last post by:
Hello, I'm looking for a library that can do the following: * Parse a simple structured text file (XML or HTML etc.) * Render its output to an image * I would like to give the maximum width...
4
by: jobs | last post by:
the javascript: function ShowTooltip(L1in) { document.getElementById("L1").innerText=L1in; y = event.clientY + document.documentElement.scrollTop; var Popup= document.getElementById("Popup")...
0
by: remya1000 | last post by:
I have a field called Departments in my database. and I have 3 monitors. So when Page_Load, I need to check number of departments I have in database. And depends upon that number of departments I...
1
by: romcab | last post by:
Hi guys, I would like to ask your idea about my current problem. I would like to create an application which run on the background. Then when I press a certain key, the GUI of the program will...
13
by: iu2 | last post by:
Hi, This is a little bit strange post, but I'm curious... I learned Python from its tutorial step by step, and practicing writing small scripts. I haven't seen a Python program before knowing...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.