0

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>

Edited by pritaeas: Moved

2
Contributors
1
Reply
5
Views
4 Years
Discussion Span
Last Post by LastMitch
0

I write mostly in VB but the client wants a specific HTML page and NOT ASP/ASPX.

The code you provide doesn't make any sense, you need another language to do that.

You want a Hit-Count in html which can be done by using php, javascript, asp.net.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.