Visualizzazione dei risultati da 1 a 6 su 6
  1. #1
    Utente bannato
    Registrato dal
    Jan 2004
    Messaggi
    439

    cerco un contatore di visite

    Buongiorno!
    Sto cercando il codice asp per fare un contatore progressivo testuale da collocare nella mia Home Page...
    Ringrazio anticipaamente

  2. #2
    codice:
    <%
    Dim CounterFile
    
    CounterFile = "counter.mdb"
    
    Dim CookieSwitch
    
    CookieSwitch = "on"
    
    Dim CounterDataConn
    Dim CounterSQL
    Dim CounterRs
    Dim CounterHits
    
    Id = Clng(CounterId)
    
    Set CounterDataConn = Server.CreateObject("ADODB.Connection")
    CounterDataConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath(CounterFile)
    CounterSQL = "SELECT * FROM Counter WHERE Id=" & Id
    Set CounterRs = CounterDataConn.Execute(CounterSQL)
    If CounterRs.EOF then
     CounterSQL = "INSERT INTO Counter(Id,Count) Values(" & Id & ",1)"
     Set CounterRs = CounterDataConn.Execute(CounterSQL)
     CounterHits = 1
    Else
     If CounterAction = "GetStatus" then
      CounterHits = Clng(CounterRs("Count"))
     Else
      If NOT Request.Cookies("CounterHits") = "" and Id = 1 then
       CounterHits = Request.Cookies("CounterHits")
      Else
       CounterHits = Clng(CounterRs("Count"))
       CounterHits = CounterHits + 1
       CounterSQL = "UPDATE counter SET count = " & CounterHits & " where id = " & id
       CounterRs = CounterDataConn.Execute(CounterSQl)
       Response.Cookies("CounterHits") = CounterHits
      End If
     End If
    End If
    
    Set CounterRs = nothing
    CounterDataConn.Close
    Set CounterDataConn = nothing%>
    questo lo metti nella pagina dove vuoi visualizzare il contatore; che richiamerai con
    codice:
    <%Response.Write CounterHits%>
    creati un dbase chiamato 'counter.mdb' con una tabella 'counter' i campi 'id e 'count'.
    tanto per cominciare, poi se vuoi le statistiche cerca nel forum statistiche weppos

  3. #3
    Utente bannato
    Registrato dal
    Jan 2004
    Messaggi
    439
    mmm :master:

    a me servirebbe una cosa semplicina scritta in VB

  4. #4
    Originariamente inviato da vodafone
    mmm :master:

    a me servirebbe una cosa semplicina scritta in VB
    ma che c'è di complicato???

  5. #5
    piu' semplice di cosi' mi sa' che non si puo' mica....
    grazie comunque, lo cercavo proprio... utilissimo !!

  6. #6
    ciao bell'esempio ma è possibile incrementarlo con una routine che conti gli accessi delle varie pagine? ( ovviamente una sola volta)
    Grazie Marco
    Carpe diem
    Preferisco tentare che rinunziare

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.