Pagina 1 di 3 1 2 3 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 21
  1. #1
    Utente di HTML.it
    Registrato dal
    Sep 2002
    Messaggi
    52

    script che sul server non funziona

    Ciao ragazzi! ho provato uno script trovato in rete per conteggiare le visite...il tutto funziona con la memorizzazione in un database access degli accessi nelle varie pagine del sito tutto questo tramite due pagine, una implementata nelle pagine stesse che ha il compito di raccogliere i dati e spedirli, alla seconda pagina che li elabora e li inserisce nel db...in locale funziona alla perfezione e sul sever no...secondo voi quale può essere il motivo...non è un problema di directory perché le pagine vengono eseguite senza errori ma il db rimane vuoto

  2. #2
    Forse se ci dici di che script si tratta o se ci dai il link, dico forse, possiamo cercare di aiutarti.

  3. #3
    Utente di HTML.it
    Registrato dal
    Sep 2002
    Messaggi
    52
    Questo è il codice da inserire nella pagina da conteggiare

    <a href="http://www.2enetworx.com/dev/projects/statcountex.asp" target="_blank" title="Get Your Copy of StatCounteX">
    <script type="text/javascript" language="JavaScript">
    // Define the location of count.asp
    // Using a path, you may use this code in any subfolder
    var file='statcountex/count.asp';

    var d=new Date();
    var s=d.getSeconds();
    var m=d.getMinutes();
    var x=s*m;
    f='' + escape(document.referrer);
    if (navigator.appName=='Netscape'){b='NS';}
    if (navigator.appName=='Microsoft Internet Explorer'){b='MSIE';}
    if (navigator.appVersion.indexOf('MSIE 3')>0) {b='MSIE';}
    u='' + escape(document.URL); w=screen.width; h=screen.height;
    v=navigator.appName;
    fs = window.screen.fontSmoothingEnabled;
    if (v != 'Netscape') {c=screen.colorDepth;}
    else {c=screen.pixelDepth;}
    j=navigator.javaEnabled();
    info='w=' + w + '&h=' + h + '&c=' + c + '&r=' + f + '&u='+ u + '&fs=' + fs + '&b=' + b + '&x=' + x;
    document.write('[img]' + file + '?'+info+ '[/img]');
    </script>
    </a>
    <noscript>
    <a href="http://www.2enetworx.com/dev/projects/statcountex.asp">
    [img]/statcountex/count.asp[/img]</a>
    </noscript>

  4. #4
    Utente di HTML.it
    Registrato dal
    Sep 2002
    Messaggi
    52
    Questi sono due spezzoni di codice, la prima parte sarà inclusa nella seconda

    <%
    'Define the location of your database with cDBStats
    'Example : cDBStats = "../securefolder/stats.mdb"
    cDBStats = "stats.mdb"

    'sImageLocation constant defines the location of the image
    'used by StatCounteX.
    const sImageLocation = "icostatcountex.gif"

    'Count your own server as referer?
    'If true, the click generated from your
    'own site will be counted as referers as well.
    bRefThisServer = false

    'Strip off the parameters from the path name?
    'If true:
    'http://www.2enetworx.com/index.asp?id=2&cid=4 is stripped to
    'http://www.2enetworx.com/index.asp
    bStripPathParameters = false

    'Strip off the parameters from the referer name?
    'If true:
    'http://www.microsoft.com/go.asp?linkid=6 is stripped to
    'http://www.microsoft.com/go.asp
    bStripRefParameters = false

    'Strip off the protocol from the path name?
    'If true:
    'http://www.2enetworx.com/index.asp?id=2&cid4 is stripped to
    '2enetworx.com/index.asp?id=2&cid4
    bStripPathProtocol = False

    'Strip off the protocol from the referer name?
    'If true:
    'http://www.microsoft.com/go.asp?linkid=6 is stripped to
    'microsoft.com/go.asp?linkid=6
    bStripRefProtocol = False

    'Strip off the path and file name from the referer name?
    'If true:
    'http://www.microsoft.com/go.asp?linkid=6 is stripped to
    'http://www.microsoft.com
    bStripRefFile = False

    'Construct the connection string
    sConnStats = "Provider=Microsoft.Jet.OLEDB.4.0;" &_
    "Persist Security Info=False;" &_
    "Data Source=" & Server.MapPath(cDBStats)

    'Pre Create the connection and recordset objects
    set conn = Server.CreateObject("ADODB.Connection")
    set rs = Server.CreateObject("ADODB.Recordset")

    'ADO Constants
    '---- CursorTypeEnum Values ----
    Const adOpenForwardOnly = 0
    Const adOpenKeyset = 1
    Const adOpenDynamic = 2
    Const adOpenStatic = 3

    '---- CursorLocationEnum Values ----
    Const adUseServer = 2
    Const adUseClient = 3

    '---- CommandTypeEnum Values ----
    Const adCmdUnknown = &H0008
    Const adCmdText = &H0001
    Const adCmdTable = &H0002
    Const adCmdStoredProc = &H0004
    Const adCmdFile = &H0100
    Const adCmdTableDirect = &H0200

    sub OpenDB(sConn)
    'Opens the given connection and initializes the recordset
    conn.open sConn
    set rs.ActiveConnection = conn
    rs.CursorType = adOpenStatic
    end sub

    sub CloseDB()
    'Closes and destroys the connection and recordset objects
    rs.close
    conn.close
    set rs = nothing
    set conn = nothing
    end sub

    sub w(sText)
    'A Quickie
    response.write sText & vbCrLf
    end sub


    %>


    config.asp è il file che contiene il codice soprastante

    <%
    function GetIdOS(sName)
    'Get OsID
    lIdOs = 1
    select case sName
    case "Win95" : lIdOs = 2
    case "Win98" : lIdOs = 3
    case "WinNT" : lIdOs = 4
    case "Win2K" : lIdOs = 5
    case "Mac" : lIdOs = 6
    case "Linux" : lIdOs = 7
    case else : lIdOs = 1
    end select
    sSQL = "SELECT Total FROM OSes WHERE OsID = " & lIdOs
    rs.Open sSQL,,,adCmdTable
    rs("Total") = CLng(rs("Total")) + 1
    rs.update
    rs.close
    GetIdOS = lIdOs
    end function

    function GetIdColor(sName)
    'Get ColorID
    lIdColor = 1
    select case sName
    case "8" : lIdColor = 2
    case "16" : lIdColor = 3
    case "24" : lIdColor = 4
    case "32" : lIdColor = 5
    case else : lIdColor = 1
    end select
    sSQL = "SELECT Total FROM Colors WHERE ColorID = " & lIdColor
    rs.Open sSQL,,,adCmdTable
    rs("Total") = CLng(rs("Total")) + 1
    rs.update
    rs.close
    GetIdColor = lIdColor
    end function

    function GetIdBrowser(sName)
    'Get BrowserID
    sSQL = "SELECT BrowserID, BrowserName, Total FROM Browsers WHERE BrowserName = '" & sName & "'"
    rs.Open sSQL,,,adCmdTable
    if rs.recordcount = 0 then
    rs.AddNew
    rs("BrowserName") = sName
    rs("Total") = 0
    end if
    rs("Total") = CLng(rs("Total")) + 1
    rs.update
    GetIdBrowser = rs("BrowserID")
    rs.close
    end function

    function GetIdPath(sName)
    'Get PathID
    sSQL = "SELECT PathID, PathName, Total FROM Paths WHERE PathName = '" & sName & "'"
    rs.Open sSQL,,,adCmdTable
    if rs.recordcount = 0 then
    rs.AddNew
    rs("PathName") = sName
    rs("Total") = 0
    end if
    rs("Total") = CLng(rs("Total")) + 1
    rs.update
    GetIdPath = rs("PathID")
    rs.close
    end function

    function GetIdRef(sName)
    'Get RefID
    sSQL = "SELECT RefID, RefName, Total FROM Refs WHERE RefName = '" & sName & "'"
    rs.Open sSQL,,,adCmdTable
    if rs.recordcount = 0 then
    rs.AddNew
    rs("RefName") = sName
    rs("Total") = 0
    end if
    rs("Total") = CLng(rs("Total")) + 1
    rs.update
    GetIdRef = rs("RefID")
    rs.close
    end function

    function GetIdRes(sName)
    'Get ResID
    sSQL = "SELECT ResID, ResName, Total FROM Resolutions WHERE ResName = '" & sName & "'"
    rs.Open sSQL,,,adCmdTable
    if rs.recordcount = 0 then
    rs.AddNew
    rs("ResName") = sName
    rs("Total") = 0
    end if
    rs("Total") = CLng(rs("Total")) + 1
    rs.update
    GetIdRes = rs("ResID")
    rs.close
    end function

    function StripParameter(sPath)
    iPlace = instr(sPath, "?")
    if iPlace then sBuffer = left(sPath, iPlace-1) else sBuffer = sPath
    StripParameter = sBuffer
    end function

    function StripProtocol(sPath)
    iPlace = instr(sPath, "://")
    if iPlace then sBuffer = right(sPath, len(sPath) - (3 + iPlace - 1)) else sBuffer = sPath
    if left(sBuffer, 4) = "www." then sBuffer = right(sBuffer, len(sBuffer) - 4)
    StripProtocol = sBuffer
    end function

    'Nevermind if error
    On Error Resume Next

    'Get parameters
    sResolution = request("w") & "x" & request("h")
    sColor = request("c")
    sPath = Request("u")
    sReferer = Request("r")
    sFontSmoothing = Request("fs")

    sIP = Request.ServerVariables("REMOTE_ADDR")
    sU = Request.ServerVariables("HTTP_USER_AGENT")

    'Process the inputs
    if sResolution = "x" then
    sResolution = "(unknown)"
    end if

    if sFontSmoothing = "true" then
    sFontSmoothing = True
    else
    sFontSmoothing = False
    end if

    if sReferer = "" then sReferer = request.servervariables("http_referer")
    if sReferer = "" then sReferer = "..."

    'This server as a referer?
    if bRefThisServer = false then
    if instr(StripParameter(sReferer), request.servervariables("http_host")) then
    sReferer = "..."
    end if
    end if

    'Referer path and file
    if bStripRefFile then
    iPlace = InstrRev(sReferer, "/")
    if iPlace then
    sReferer = left(sReferer, iPlace - 1)
    end if
    end if

    'Path Parameters
    if bStripPathParameters then
    sPath = StripParameter(sPath)
    end if

    'Path Protocol
    if bStripPathProtocol then
    sPath = StripProtocol(sPath)
    end if

    'Referer Parameters
    if bStripRefParameters then
    sReferer = StripParameter(sReferer)
    end if

    'Referer Protocol
    if bStripRefProtocol then
    sReferer = StripProtocol(sReferer)
    end if

    if sPath = "" then sPath = "/"

    if instr(sU, "98") then sOS = "Win98"
    if instr(sU, "95") then sOS = "Win95"
    if instr(sU, "NT") then sOS = "WinNT"
    if instr(sU, "NT 5") then sOS = "Win2K"
    if instr(sU, "Linux") then sOS = "Linux"
    if instr(sU, "Mac") then sOS = "Mac"

    sBrowserType = request("b")
    select case sBrowserType
    case "MSIE"
    p1 = instr(sU, ";")
    p2 = instr(p1+1, sU, ";")
    sBrowser = mid(sU, p1+2, (p2-p1)-2)
    case "NS"
    sBrowser = "NS " & mid(sU, 9, 3)
    if instr(sU, "Netscape") then
    i = instr(20, sU, "/")
    sBrowser = "NS " & right(sU, len(sU)-i)
    end if
    case else
    sBrowser = sU
    end select

    'Open the database
    OpenDB sConnStats

    'Get ID's by Names
    lIdOS = GetIdOS(sOS)
    lIdColor = GetIdColor(sColor)
    lIdBrowser = GetIdBrowser(sBrowser)
    lIdPath = GetIdPath(sPath)
    lIdRef = GetIdRef(sReferer)
    lIdRes = GetIdRes(sResolution)

    sSQL = "SELECT * FROM Stats"
    rs.Open sSQL,,,adCmdTable

    'Save the data
    rs.AddNew
    rs("OsID") = lIdOS
    rs("ColorID") = lIdColor
    rs("BrowserID") = lIdBrowser
    rs("PathID") = lIdPath
    rs("RefID") = lIdRef
    rs("ResID") = lIdRes
    rs("Date") = date
    rs("Time") = time
    rs("IP") = sIP
    rs.Update
    'Terminate database connection
    CloseDB

    %>


    Ciao grazie!

  5. #5
    Ma il database lo hai messo nella cartella con permessi di scrittura o l'hai semplicemente messo nella Root del sito?

  6. #6
    Dicci che errore ti da.

  7. #7
    Utente di HTML.it
    Registrato dal
    Sep 2002
    Messaggi
    52
    Il db è nella root e cosa strana, non da errori...però non funziona!

  8. #8
    mmm, si tratta di statcountex, mi dici l'url esatto che digiti per vedere le statistiche ?

  9. #9
    Utente di HTML.it
    Registrato dal
    Sep 2002
    Messaggi
    52
    Originariamente inviato da alexba64
    mmm, si tratta di statcountex, mi dici l'url esatto che digiti per vedere le statistiche ?
    Hai provato anche te statcountex?

    Ma guarda che l'url delle pagine che mi danno le statistiche sono "all'interno del mio dominio" non devo fare collegamenti ad altri siti o altro

    Cmq se mi sapete dare altri link di script simili funzionanti, ben vengano...ho provato diversi script ma tutti più o meno mi davano errori così dopo aver vagliato diversi script ho scelto quello che mi dava meno problemi...( infatti...meno problemi....)

  10. #10
    Ma guarda che l'url delle pagine che mi danno le statistiche sono "all'interno del mio dominio
    lo so

    Volevo solo sapere l'url che digiti per vedere le statistiche del tuo sito tipo:


    www.tuosito.com/statistiche/reports.asp o altro

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.