...

View Full Version : Member Counter...



The Wizzard
07-14-2002, 07:06 PM
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! :thumbsup:

oracleguy
07-15-2002, 12:10 AM
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.

Morgoth
07-16-2002, 08:04 PM
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?

JoeP
07-16-2002, 10:32 PM
Some global.asa examples of listing members:

http://www.aspalliance.com/AlexCampbell/AlexASP_Portal/AA_Content/ViewArticle/?ID=15&Version=ASP

http://www.aspalliance.com/AlexCampbell/AlexASP_Portal/AA_Content/ViewArticle/Default.aspx?ID=15&PrintView=True



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

http://www.4guysfromrolla.com/webtech/061399-2.shtml

whammy
07-17-2002, 02:10 AM
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. :)

The Wizzard
07-18-2002, 08:45 PM
oracleguy, how do i make the field determine if the users session is "True" or "False"?

Thanks!

oracleguy
07-18-2002, 09:31 PM
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.

christrinder
11-27-2002, 01:56 PM
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

Morgoth
11-27-2002, 07:13 PM
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 (http://www.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.

christrinder
11-27-2002, 07:40 PM
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

Morgoth
11-27-2002, 07:52 PM
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.

christrinder
11-28-2002, 10:56 AM
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

Morgoth
11-28-2002, 01:25 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum