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 2 of 2

Thread: active users

  1. #1
    New to the CF scene
    Join Date
    Aug 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    active users

    the problem is this :
    a registered user him authentic stamp him to video her pseudonym (login)

    example:
    active users: giuseppe, antonio, giovanni

    when it finishes the session of giuseppe, antonio, giovanni
    active users: anybody

    when giuseppe is still authenticated

    active users: giuseppeantoniogiovanni giuseppe

    technically they call "suspended users"
    my files:

    global.asa:
    Code:
    <script LANGUAGE="VBScript" RUNAT="Server"> 
    Sub Application_OnStart 
    strConn = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source="&Server.MapPath("/mdb-database/crm.mdb") 
    application.lock 
    Application("Utente") = "" 
    application("users") = 0 
    Application("dbconn") = strConn 
    application.unlock 
    End Sub 
    
    Sub Application_OnEnd 
    End Sub 
    
    Sub Session_OnStart 
    Session("start") = Now 
    session.timeout = 20 
    
    set objconnvisite=Server.createobject("ADODB.Connection") 
    Set objrsvisite = Server.CreateObject("ADODB.Recordset") 
    objconnvisite.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" &Server.mappath("/mdb-database/counterdb.mdb") 
    objconnvisite.Open 
    
    oggi=date() 
    ipvisit=request.servervariables("remote_addr") 
    
    'SQL quando data=oggi e l'ip  nuovo 
    strSQL="SELECT * FROM tbl_sessioni WHERE datepart('d',visitdate)="&datepart("d",oggi)&" AND datepart('m',visitdate)="&datepart("m",oggi)&" AND datepart('yyyy',visitdate)="&datepart("yyyy",oggi)&" AND visitorIP='"&ipvisit&"'" 
    objrsvisite.Open strSQL, objconnvisite, 3, 3 
    if (objrsvisite.EOF OR objrsvisite.BOF) then 
    'prima sessione odierna dell'ip ipvisit 
    objrsvisite.addnew 
    objrsvisite("visitdate")=oggi 
    objrsvisite("visitorip")=ipvisit 
    end if 
    objrsvisite("visitorcount")=objrsvisite("visitorcount")+1 
    objrsvisite.update 
    objrsvisite.Close 
    Set objrsvisite = Nothing 
    objconnvisite.Close 
    Set objconnvisite = Nothing 
    
    application.lock 
    application("users")=cint(application("users"))+1 
    Session("login") = False 
    application.unlock 
    End Sub 
    
    Sub Session_OnEnd 
    application.lock 
    Application("Utente") = Replace( Application("Utente") , Session("utente") & "|" ,"") 
    application("users")=cint(application("users"))-1 
    Application.UnLock 
    End Sub 
    </script>
    connected.asp:
    Code:
    <% 
    Dim arrUtenti 
    Response.Write "<B><font color=blue size=1 font face=verdana>Usuarios en Linea:</font></B>" 
    arrUtenti = Split(Application("Utente"),"|") 
    dim utenti 
    for i = 0 to UBound(arrUtenti)-1 
    if i <> UBound(arrUtenti)-1 then 
    utenti = utenti & arrUtenti(i) & ", " 
    else 
    utenti = utenti & arrUtenti(i) 
    end if   
    Next 
    Response.Write "<font color=red size=1 font face=verdana> " & utenti & "</font>" 
    %>
    login.asp:
    Code:
    <% 
    Option Explicit 
    Response.Buffer = True 
    Dim objConn, strConn, objRs, strsql 
    Dim submitted, login, password 
    %> 
    <% 
    
    submitted = Request.Querystring("submitted") 
    
    If Submitted then 
    
        strConn = Application("dbconn") 
    
        login = Request.Form("login") 
        password = Request.Form("password") 
         
        strsql = "Select id, permesso, login1, password1 FROM tbl_login " 
        strsql = strsql & "WHERE login1 ='" & login & "' AND password1 = '" & password & "'" 
         
         
        Set objConn = Server.CreateObject("ADODB.Connection") 
        objConn.Open strConn 
        set objRs = objConn.Execute(strsql) 
         
        If objRs.EOF then 
            'Non e' valido, mandalo indietro 
            response.redirect "dx_old.asp" 
        Else 
             
            'e' valido, fallo entrare 
             
            session("login") = True 
             
    Session("utente") = Request("login") 
    if InStr(1, Application("Utente"), Session("utente") & "|" ) = 0 then 
    Application.Lock 
    Application("Utente") = Application("Utente") & Session("utente") & "|" 
    Application.UnLock 
    end if         
             
            session("aut")=objrs("permesso") 
            session("userName")=objrs("login1") 
            session("id") = objrs("id") 
        
            objRs.close 
            Set objRs = Nothing 
            response.redirect "ufficio.asp" 
        end if 
    else 
    %> 
    <% 
    end if 
    Response.end 
    Response.Clear 
    %>
    which is my error?
    thanks

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    358
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Sorry, not understand what actually u want...
    can u go into more detail?
    Thanks.
    =====================================================
    From NinjaTurtle
    ++http://ohmygoh.blogspot.com|http://technology.ohmygoh.com++


  •  

    Posting Permissions

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