...

View Full Version : active users



logitechfree
08-05-2004, 09:03 PM
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:
<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:

<%
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:

<%
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 :confused:

NinjaTurtle
08-10-2004, 03:56 AM
Sorry, not understand what actually u want...
can u go into more detail?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum