...

View Full Version : Who is Online???



sasha85
10-25-2007, 05:56 PM
i need to view a list of logged in users...
now i got login\logout thing going on...but if the user will not logout he will be still logged on for the system...
the only rule i want (on this code that i don't know how to wrote) is how to set timeout of 1 hour...that id the user had not moved or did nothing for 1 hour he automaticly will be offline for the system...

BarrMan
10-25-2007, 06:14 PM
You can use the global.asa to get the user's status and have the events when the user joins a website and leaves it.
IE:

Global.asa
Sub Application_OnStart
Application.Lock
Application("user_count") = 0
Application.UnLock
End Sub

Sub Session_OnStart
Application("user_count") = Application("user_count") + 1
End Sub

Sub Session_OnEnd
Application("user_count") = Application("user_count") - 1
'Search for the username inside the Users array and remove it.
End Sub

After login
'Add a new user to the Users array
Dim Users()
ReDim Users(UBound(Users))
Users(UBound(Users)-1) = newUserName

sasha85
10-25-2007, 07:22 PM
the users got to login username+password and than they get some, for example session("login")="true"
do i need to run appliaction too? if i do then how?

can you explain me how this code works?

i never used global.asa before

sasha85
10-25-2007, 08:10 PM
some thing like this maybe???? :confused:


Sub Session_OnStart
Application("active_visitors")=Application("active_visitors")+1
dim conn, rs
if Session("USERNAME")<>"" then
rs.Open "Members where Username='" & Session("USERNAME")
rs("Online")=1
rs.Update
end if
End Sub

can i add includes into asa file?

do i need?
Application.Lock
Application.UnLock

BarrMan
10-27-2007, 02:59 PM
Here: http://w3schools.com/asp/asp_globalasa.asp
This might help you.

sasha85
10-29-2007, 06:29 PM
barrman you forgot to tell me that Session_OnEnd never shoots...i cannot use Session_Onstart cause the asa runs first and you cannot read any info about the user before of the asa...=>you cannot separate between the users



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum