Ho trovato questo script per inserire un semplice contatore di visite su una pagina (che aumenta a ogni refresh)..
funziona tutto tranne il fatto che il contatore non aumenta![]()
è perchè conta le visite uniche oppure ho sbagliato qualcosa?
grazie mille!
---
The code bellow is prepared to be added to your asp pages and it will automatically start counting hits for the page containning it. You may copy the same code to several ASP pages, and the script will count hits for all pages individually.
You must create a subfolder named "Mycounters" within the cgi-bin directory. The name of the subdirectory may be changed in the script.
The script will atomatically create one counter (one file within subfolder "Mycounters") per each page containing the script bellow in the first visit. Each time a page is visited the corresponding counter will be open, read the number of hits, increased by one and the new number of hits save to the same counter file.
The name of individual counters within subfolder "Mycounters" will shown the path to the page visited. For example:
Hits at /index.asp will be save to /cgi-bin/mycounters/indexasp.txt
Hits at /mydir1/page1.asp will be save to /cgi-bin/mycounters/mydir1page1asp.txt
---
<%
file=request.servervariables("PATH_INFO")
file = replace(file,"/","")
file = replace(file,".","")
if file="" then
file="otros"
end if
Set fs = CreateObject("Scripting.FileSystemObject")
Wfile=server.mappath("\") & "\cgi-bin\Mycounters\" & file & ".txt"
on error resume next
Set a = fs.OpenTextFile(Wfile)
hits = Clng(a.ReadLine)
hits = hits + 1
a.close
if error then
hits = 1
end if
Set a = fs.CreateTextFile(Wfile,True)
a.WriteLine(hits)
a.Close
%>
Number of hits: <% =hits %>
---

Rispondi quotando
