Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-14-2002, 07:06 PM   PM User | #1
The Wizzard
Regular Coder

 
Join Date: Jun 2002
Location: Lake Forest, CA
Posts: 259
Thanks: 0
Thanked 0 Times in 0 Posts
The Wizzard is an unknown quantity at this point
Member Counter...

Hi, i have a member login system, and what i want to do is, on the main page, tell anyone who comes to my website, how many members are logged in, and list there usernames.

Thanks!
The Wizzard is offline   Reply With Quote
Old 07-15-2002, 12:10 AM   PM User | #2
oracleguy
Rockstar Coder


 
Join Date: Jun 2002
Location: USA
Posts: 9,043
Thanks: 1
Thanked 322 Times in 318 Posts
oracleguy is a jewel in the roughoracleguy is a jewel in the roughoracleguy is a jewel in the rough
I'm working on something similar at the moment. What I figured out is to add an additional field to the table that I used to store usernames and passwords. That when they logged in was changed to 'true' then when they logged off or their session timed out it changed it to 'false'.

So then I made a SSI that ran the SQL query of

strQuery="SELECT * from 'users' where 'Status'='True'"

Then it just counts and lists the usernames that are logged in.
__________________
OracleGuy
oracleguy is offline   Reply With Quote
Old 07-16-2002, 08:04 PM   PM User | #3
Morgoth
Senior Coder

 
Morgoth's Avatar
 
Join Date: Jun 2002
Location: Ontario, Canada Remaining Brain Cells: 6
Posts: 1,402
Thanks: 2
Thanked 1 Time in 1 Post
Morgoth is an unknown quantity at this point
That's the way I will do mine aswell.

I haven't started it, but I have learned that is a good way to do it.

But I never really looked into it.

Since I run my own server, is there away to use the global.asa file for this?
Morgoth is offline   Reply With Quote
Old 07-16-2002, 10:32 PM   PM User | #4
JoeP
Regular Coder

 
Join Date: Jun 2002
Location: Plano, Texas
Posts: 113
Thanks: 0
Thanked 0 Times in 0 Posts
JoeP is an unknown quantity at this point
Some global.asa examples of listing members:

http://www.aspalliance.com/AlexCampb...15&Version=ASP

http://www.aspalliance.com/AlexCampb...PrintView=True



4Guys With an example of just the number of visitors on line:

http://www.4guysfromrolla.com/webtech/061399-2.shtml
JoeP is offline   Reply With Quote
Old 07-17-2002, 02:10 AM   PM User | #5
whammy
Senior Coder

 
Join Date: Jun 2002
Location: 41° 8' 52" N -95° 53' 31" W
Posts: 3,660
Thanks: 0
Thanked 0 Times in 0 Posts
whammy is an unknown quantity at this point
I've used the global.asa to do this, it should work fine for you. There is even an example at http://www.w3schools.com/asp if you look at the "global.asa" link.
__________________
Former ASP Forum Moderator - I'm back!

If you can teach yourself how to learn, you can learn anything. ;)
whammy is offline   Reply With Quote
Old 07-18-2002, 08:45 PM   PM User | #6
The Wizzard
Regular Coder

 
Join Date: Jun 2002
Location: Lake Forest, CA
Posts: 259
Thanks: 0
Thanked 0 Times in 0 Posts
The Wizzard is an unknown quantity at this point
oracleguy, how do i make the field determine if the users session is "True" or "False"?

Thanks!
The Wizzard is offline   Reply With Quote
Old 07-18-2002, 09:31 PM   PM User | #7
oracleguy
Rockstar Coder


 
Join Date: Jun 2002
Location: USA
Posts: 9,043
Thanks: 1
Thanked 322 Times in 318 Posts
oracleguy is a jewel in the roughoracleguy is a jewel in the roughoracleguy is a jewel in the rough
You'd write to the database when the logged in.


Then in your globa.asa(x) you'd have in the Session_OnEnd have it write to the database again setting it back to false.
__________________
OracleGuy
oracleguy is offline   Reply With Quote
Old 11-27-2002, 01:56 PM   PM User | #8
christrinder
Regular Coder

 
Join Date: Nov 2002
Location: Loughborough (UK)
Posts: 209
Thanks: 0
Thanked 0 Times in 0 Posts
christrinder is an unknown quantity at this point
session end

Hi Guys,

Just been reading through your posts, your original query is something I wanted to do. I'm not at all familiar with whatever asa global is, so is there another way I can return to the logged-in field to false when their session expires??

Thanks,

Chris
christrinder is offline   Reply With Quote
Old 11-27-2002, 07:13 PM   PM User | #9
Morgoth
Senior Coder

 
Morgoth's Avatar
 
Join Date: Jun 2002
Location: Ontario, Canada Remaining Brain Cells: 6
Posts: 1,402
Thanks: 2
Thanked 1 Time in 1 Post
Morgoth is an unknown quantity at this point
Re: session end

Quote:
Originally posted by christrinder
Hi Guys,

Just been reading through your posts, your original query is something I wanted to do. I'm not at all familiar with whatever asa global is, so is there another way I can return to the logged-in field to false when their session expires??

Thanks,

Chris

Well first off, Chris. Do you run your own server, or are you being hosted online? Like @ Brinkster.com?

If you run your own server, it would be good to use Global.asa, and the few links above talk about usiong Global.asa and if it's right for you.

I think Session Time Out is not part of global.asa as much as it just deals with an internal Timer. I think a session lasts about 5-10 minutes, but I am not sure.
Your host might allow you to use a global.asa somehow.
Morgoth is offline   Reply With Quote
Old 11-27-2002, 07:40 PM   PM User | #10
christrinder
Regular Coder

 
Join Date: Nov 2002
Location: Loughborough (UK)
Posts: 209
Thanks: 0
Thanked 0 Times in 0 Posts
christrinder is an unknown quantity at this point
Thanks

Hi,

Thanks. I'm using Brinkster for my own site, although I am also developing one for use on a network, through window's PWS thing. Any ideas?

Cheers,

Chris
christrinder is offline   Reply With Quote
Old 11-27-2002, 07:52 PM   PM User | #11
Morgoth
Senior Coder

 
Morgoth's Avatar
 
Join Date: Jun 2002
Location: Ontario, Canada Remaining Brain Cells: 6
Posts: 1,402
Thanks: 2
Thanked 1 Time in 1 Post
Morgoth is an unknown quantity at this point
If you have a free account from brinkster then you are unable to use the global.asa

But on you PWS you can use a global.asa file and you can add all this stuff inside it.

I guess you will just need to wait untilt he PWS is ready and then you can use it.
Morgoth is offline   Reply With Quote
Old 11-28-2002, 10:56 AM   PM User | #12
christrinder
Regular Coder

 
Join Date: Nov 2002
Location: Loughborough (UK)
Posts: 209
Thanks: 0
Thanked 0 Times in 0 Posts
christrinder is an unknown quantity at this point
Non global ASA

Thanks for that.

So is there another way I can return the 'loggedin' field to false when the session expires? I'm not particularly sure of the command I should write to make this happen? Any suggestions, or handy example codes?

Thanks,

Chris
christrinder is offline   Reply With Quote
Old 11-28-2002, 01:25 PM   PM User | #13
Morgoth
Senior Coder

 
Morgoth's Avatar
 
Join Date: Jun 2002
Location: Ontario, Canada Remaining Brain Cells: 6
Posts: 1,402
Thanks: 2
Thanked 1 Time in 1 Post
Morgoth is an unknown quantity at this point
In the global.asa file you can add:

Sub Session_OnEnd
Set oConn = Server.CreateObject("ADODB.Connection")
StrConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("db.mdb") & ";"
oConn.open StrConn

sSQL = "UPDATE Members SET Loggedin=False WHERE (ID=" & Session("ID") & ")"
Set oRS = oConn.Execute(sSQL)
End Sub

Session("ID") = The ID number of the person in the session (A login script where you add the info to the cookies is a good place to make the Session("ID") tag.

Though, for some odd reason I am having troble with this script. I don't know what's wrong with it, but I am starting a new thread seeing if anyone can help me.
Morgoth is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:07 PM.


Advertisement
Log in to turn off these ads.