<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Sub Application_OnStart
Application("ActiveUsers") = 0
End Sub
Sub Session_OnStart
agenti
'segnamotore
' 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
'controllo agenti
Sub agenti
UserAgent = UCASE(Request.servervariables("HTTP_USER_AGENT"))
Application("AgenteWeb") = UserAgent
' GOOGLE
if instr(UserAgent, "GOOGLE") > 0 then
segnamotore
Session.Abandon
end if
' MSN
if instr(UserAgent, "MSNBOT") > 0 then
segnamotore
Session.Abandon
end if
' ALTAVISTA
if instr(UserAgent, "SCOOTER") > 0 then
segnamotore
Session.Abandon
end if
' YAHOO
if instr(UserAgent, "SLURP") > 0 then
segnamotore
Session.Abandon
end if
' BOITHO
if instr(UserAgent, "BOITHO") > 0 then
segnamotore
Session.Abandon
end if
' ARIANNA
if instr(UserAgent, "ARIANNA") > 0 then
segnamotore
Session.Abandon
end if
' LYCOS
if instr(UserAgent, "LYCOS") > 0 then
segnamotore
Session.Abandon
end if
' MATRIX S.P.A. BOOT
if instr(UserAgent, "MATRIX") > 0 then
segnamotore
Session.Abandon
end if
' CONVERACRAWLER BOOT
if instr(UserAgent, "CONVERACRAWLER") > 0 then
segnamotore
Session.Abandon
end if
' VIRGILIO BOT
if instr(UserAgent, "VirgilioBot") > 0 then
segnamotore
Session.Abandon
end if
' HenryTheMiragoRobot
if instr(UserAgent, "HenryTheMiragoRobot") > 0 then
segnamotore
Session.Abandon
end if
end sub
sub segnamotore
Dim fsoMyFile
Dim tsTextStream
'Creazione dell'istanza FSO.
Set fsoMyFile = CreateObject("Scripting.FileSystemObject")
'Apertura del file, in aggiunta dati (8), se non esiste lo crea (True).
'Set tsTextStream = fsoMyFile.CreateTextFile("C:\Inetpub\
www.sito.it\motorediricerca.txt")
Set tsTextStream = fsoMyFile.OpenTextFile("C:\Inetpub\
www.sito.it\motorediricerca.txt", 8, True)
'Scrive una riga.
tsTextStream.WriteLine (Request.servervariables("HTTP_USER_AGENT") & " - " & now())
'Scrive 5 righe vuote nel file.
'tsTextStream.WriteBlankLines(1)
'Chiude il file.
tsTextStream.Close
set tsTextStream = nothing
set fsoMyFile = nothing
end sub
</SCRIPT>