Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Sep 2007
    Posts
    179
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Question Who is Online???

    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...
    By the time u recognize this moment, This moment will be gone.

  • #2
    Senior Coder BarrMan's Avatar
    Join Date
    Feb 2005
    Location
    Israel.
    Posts
    1,644
    Thanks
    69
    Thanked 83 Times in 82 Posts
    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:
    Code:
    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

  • #3
    Regular Coder
    Join Date
    Sep 2007
    Posts
    179
    Thanks
    4
    Thanked 0 Times in 0 Posts

    sorry i don't understand:(

    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
    Last edited by sasha85; 10-25-2007 at 08:32 PM.
    By the time u recognize this moment, This moment will be gone.

  • #4
    Regular Coder
    Join Date
    Sep 2007
    Posts
    179
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Exclamation in global.asa

    some thing like this maybe????
    Code:
    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
    By the time u recognize this moment, This moment will be gone.

  • #5
    Senior Coder BarrMan's Avatar
    Join Date
    Feb 2005
    Location
    Israel.
    Posts
    1,644
    Thanks
    69
    Thanked 83 Times in 82 Posts
    Here: http://w3schools.com/asp/asp_globalasa.asp
    This might help you.

  • #6
    Regular Coder
    Join Date
    Sep 2007
    Posts
    179
    Thanks
    4
    Thanked 0 Times in 0 Posts

    yee but...

    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
    By the time u recognize this moment, This moment will be gone.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •