Pagina 2 di 3 primaprima 1 2 3 ultimoultimo
Visualizzazione dei risultati da 11 a 20 su 21
  1. #11
    Utente di HTML.it L'avatar di viki1967
    Registrato dal
    Feb 2003
    Messaggi
    1,757
    Cosa ci fai con il global.asa, solo utenti connessi ?
    A S P : tutto il resto è noia...
    L I N U X : forse mi "converto"...

  2. #12
    Scusa ma sono stato fuori.
    Il global.asa lo uso per il forum (snitz) e per la conquerchat, ma ho provato anche lo script per utenti connessi da solo eliminando tutto il resto, ma la musica non cambia.
    Quello che uso per il forum e per la chat è questo:
    codice:
    <SCRIPT LANGUAGE=VBScript RUNAT=Server>
    Sub Application_OnStart
    	'==FrontPage Generated - startspan==
    	Dim FrontPage_UrlVars(0)
    	'--
    	Application("FrontPage_UrlVars") = FrontPage_UrlVars
    	'==FrontPage Generated - endspan==
    End Sub
    Sub Session_OnStart
    	FrontPage_StartSession '==FrontPage Generated==
    	FrontPage_ConvertFromODBC '==FrontPage Generated==
    End Sub
    Sub FrontPage_StartSession
    	On Error Resume Next
    	if Len(Application("FrontPage_VRoot")) > 0 then Exit Sub
    	
    	sFile = "global.asa"
    	sRootPath = Request.ServerVariables("APPL_PHYSICAL_PATH")
    	if Left(sRootPath,1) = "/" then sSep = "/" else sSep = "\"
    	if Right(sRootPath,1) <> sSep then sRootPath = sRootPath & sSep
    	sRootPath = sRootPath & sFile
    	
    	' discover the VRoot for the current page;
    	' walk back up VPath until we match VRoot
    	Vroot = Request.ServerVariables("PATH_INFO")
    	iCount = 0
    	do while Len(Vroot) > 1
    		idx = InStrRev(Vroot, "/")
    		if idx > 0 then
    			Vroot = Left(Vroot,idx)
    		else
    			' error; assume root web
    			Vroot = "/"
    		end if
    		if Server.MapPath(Vroot & sFile) = sRootPath then exit do
    		if Right(Vroot,1) = "/" then Vroot = Left(Vroot,Len(Vroot)-1)
    		iCount = iCount + 1
    		if iCount > 100 then
    			' error; assume root web
    			Vroot = "/"
    			exit do
    		end if
    	loop
    	' map all URL= attributes in _ConnectionString variables
    	Application.Lock
    	if Len(Application("FrontPage_VRoot")) = 0 then
    		Application("FrontPage_VRoot") = Vroot
    		UrlVarArray = Application("FrontPage_UrlVars")
    		for i = 0 to UBound(UrlVarArray)
    			if Len(UrlVarArray(i)) > 0 then FrontPage_MapUrl(UrlVarArray(i))
    		next
    	end if
    	Application.Unlock
    End Sub
    Sub FrontPage_MapUrl(AppVarName)
    	' convert URL attribute in conn string to absolute file location
    	strVal = Application(AppVarName)
    	strKey = "URL="
    	idxStart = InStr(strVal, strKey)
    	If idxStart = 0 Then Exit Sub
    	strBefore = Left(strVal, idxStart - 1)
    	idxStart = idxStart + Len(strKey)
    	idxEnd = InStr(idxStart, strVal, ";")
    	If idxEnd = 0 Then
    		strAfter = ""
    		strURL = Mid(strVal, idxStart)
    	Else
    		strAfter = ";" & Mid(strVal, idxEnd + 1)
    		strURL = Mid(strVal, idxStart, idxEnd - idxStart)
    	End If
    	strOut = strBefore & Server.MapPath(Application("FrontPage_VRoot") & strURL) & strAfter
    	Application(AppVarName) = strOut
    End Sub
    Sub FrontPage_ConvertFromODBC
    	On Error Resume Next
    	if Len(Application("ASP_OS")) > 0 then exit sub
    	str = "_ConnectionString"
    	slen = Len(str)
    	set oKnown = Server.CreateObject("Scripting.Dictionary")
    	oKnown.Add "DRIVER",""
    	oKnown.Add "DBQ",""
    	oKnown.Add "SERVER",""
    	oKnown.Add "DATABASE",""
    	oKnown.Add "UID",""
    	oKnown.Add "PWD",""
    	Application.Lock
    	For each item in Application.Contents
    		if UCase(Right(item,slen)) = UCase(str) then
    			sName = Left(item,Len(item)-slen)
    			sConn = Application(item)
    			if InStr(LCase(sConn),"provider=") < 1 and Len(Application(sName & "_ConnectionTimeout"))>0 then
    				sArr = Split(sConn,";")
    				set oDict = Server.CreateObject("Scripting.Dictionary")
    				bUnknown = False
    				for i = 0 to UBound(sArr)
    					s = sArr(i)
    					idx = InStr(s,"=")
    					sKey = UCase(Trim(Left(s,idx-1)))
    					sVal = Trim(Mid(s,idx+1))
    					oDict.Add sKey, sVal
    					if Not oKnown.Exists(sKey) then bUnknown = True
    				next
    				if bUnknown = False and oDict.Exists("DRIVER") then
    					sDrv = oDict.Item("DRIVER")
    					sNew = ""
    					if InStr(sDrv,"Microsoft Access") > 0 and oDict.Exists("DBQ") and not (oDict.Exists("UID") or oDict.Exists("PWD")) then
    						sNew = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & oDict.Item("DBQ")
    					elseif InStr(sDrv,"SQL Server") > 0 and oDict.Exists("SERVER") and oDict.Exists("DATABASE") then
    						sNew = "Provider=SQLOLEDB;Data Source=" & oDict("SERVER") & ";Initial Catalog=" & oDict("DATABASE")
    						if oDict.Exists("UID") then sNew = sNew & ";User ID=" & oDict("UID")
    						if oDict.Exists("PWD") then sNew = sNew & ";Password=" & oDict("PWD")
    					end if
    					if sNew <> "" then
    						Application(item) = sNew
    					end if
    				end if
    				set oDict = Nothing
    			end if
    		end if
    	Next
    	Application.Unlock
    	Set oKnown = Nothing
    End Sub
    </SCRIPT>
    
    
    
    
    <OBJECT
    	RUNAT="Server"
    	SCOPE="Application" 
    	ID="conquerChatUsers"
    	PROGID="Scripting.Dictionary">
    </OBJECT>
    
    <OBJECT
    	RUNAT="Server"
    	SCOPE="Application" 
    	ID="conquerChatRooms"
    	PROGID="Scripting.Dictionary">
    </OBJECT>
    
    <OBJECT
    	RUNAT="Server"
    	SCOPE="Application" 
    	ID="conquerChatMessages"
    	PROGID="Scripting.Dictionary">
    </OBJECT>
    Ho provato ad aggiungerci questo:
    codice:
    <SCRIPT LANGUAGE="VBScript" RUNAT="Server">
    Sub Application_OnStart
      Application("ActiveUsers") = 0
    End Sub
    
    Sub Session_OnStart
      ' setta il timeout di default 10
      Session.Timeout = 10
      Application.Lock
      Application("ActiveUsers") = Application("ActiveUsers") + 1
      Application.UnLock
    End Sub
    
    Sub Session_OnEnd
      ' quando il visitatore esce (-1)
      Application.Lock
      Application("ActiveUsers") = Application("ActiveUsers") - 1
      Application.UnLock
    End Sub
    </SCRIPT>
    posizionandolo tra </SCRIPT> e <OBJECT... e in locale funziona, ma online no !

  3. #13
    Ehm, potete aiutarmi? stò utilizzando questo codice - da voi suggerito - ficcato dentro un file global.asa:


    <SCRIPT language="VBScript" Runat="Server">

    Sub Application_OnStart
    'Imposta a 0 il numero di utenti quando parte il servizio server
    Application("intActiveUserNumber") = 0
    Application.unlock
    End Sub

    Sub Application_OnEnd
    End Sub

    Sub Session_OnStart
    '2 minuti di timeout
    Session.Timeout = 2
    'Incremento il numero di utenti all'inizio di una nuova sessione
    Application.Lock
    Application("intActiveUserNumber") = (Application("intActiveUserNumber") + 1 )
    Application.UnLock
    End Sub

    Sub Session_OnEnd
    'Decremento il numero di utenti alla fine di ogni sessione
    Application.Lock
    Application("intActiveUserNumber") = (Application("intActiveUserNumber") - 1)
    Application.UnLock
    End Sub

    </SCRIPT>



    Il problema è che il contatore salta da 1 a 2 (e fin qui ok) ma poi a 4, 6, 8, 10 ecc.
    Cioè arrivato a 2 anzichè passare a 3 salta di due in due
    Where there is a will, there is a way

  4. #14
    Se sei su Aruba non funziona, io ci ho rinunciato a provare a farlo funzionare.

  5. #15
    Originariamente inviato da michele.santoro
    Se sei su Aruba non funziona, io ci ho rinunciato a provare a farlo funzionare.
    Ebbene si sono su Aruba... si comporta in modo strano, davvero non capisco.
    Where there is a will, there is a way

  6. #16
    Bisognerebbe provare a sentire quelli di Aruba perché si comporta in quel modo. A me aumentava di una unità ad ogni refresh di pagina.
    Se si trova una soluzione sarei interessato anch'io e ... penso anche altri.

  7. #17
    qualcuno ha sentito i responsabili Aruba e/o trovato una soluzione a questo problema?
    Where there is a will, there is a way

  8. #18
    Utente di HTML.it L'avatar di Lak3d
    Registrato dal
    Aug 2006
    Messaggi
    1,031
    per quale oscuro motivo usate il session.OnEnd che si scatena quando decade la sessione e non il Session.Abandon che si scatena quando si chiude la finestra?

  9. #19
    questo non toglie il problema del +2 anzichè +1

    Per me resta un mistero
    Where there is a will, there is a way

  10. #20
    Utente di HTML.it L'avatar di Lak3d
    Registrato dal
    Aug 2006
    Messaggi
    1,031
    se siete giunti alla conclusione che è colpa dei settaggi di Aruba, per quale motivo lo definisci un mistero? :master:

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.