GoodDay All.
I am trying to create a hit counter in vbscript on a HTML Page for specific client needs. I cannot use any hit counters available for free.
My problem is that my code only finds the text file on my notebook(Local C:\ drive) and not in the website even though the file does exist.
my other problem is that when the page code reaches the "server.creatobject" line, i get the error (Microsoft VBScript runtime error: Object required: 'server').
I write mostly in VB but the client wants a specific HTML page and NOT ASP/ASPX.
Can someone help me please. I have been trying for a while and cannot get a decent answer to my above questions.
Below is the code.
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Dim fso
dim tso
dim FilObject
dim VisitorCount
dim strOutputName
dim objOutputfile
strfilename ="counter.txt"
set fso=server.createobject("scripting.filesystemobject")
set filobject=fso.getfile(strfilename)
set tso=filobject.openastextstream
visitorcount=clng(tso.readall)
visitorcount=visitorcount + 1
stroutputname=strfilename
set objoutputfile=fso.createtextfile(stroutputname,true)
objoutputfile.writeline visitorcount
document.write(visitorcount)
</script>