<%
Dim Connection, RS, Page, Counts
Page=Request.ServerVariables("SCRIPT_NAME")
Set Connection=Server.Createobject("ADODB.Connection")
Connection.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("../../mdb-database/contatore.mdb")
If Len(Session(Page)) = 0 Then
Set RS = Connection.Execute("SELECT * FROM TabContatore WHERE pagina = '" & Page & "'")
If RS.EOF = TRUE Then
Connection.Execute("INSERT INTO TabContatore (pagina, visite) VALUES ('"&Page&"', 0)")
End If
Set RS = Connection.Execute("SELECT * FROM TabContatore WHERE pagina = '" & Page & "'")
Counts=RS("visite")+1
Set RS = Connection.Execute("UPDATE TabContatore SET visite = " & Counts & " WHERE pagina = '" & Page & "'")
Session(Page) = "something"
Connection.Close
Else
Set RS = Connection.Execute("SELECT * FROM TabContatore WHERE pagina = '" & Page & "'")
Counts=RS("visite")
End If
%>