![]() |
||
Gender and Development for CambodiaNo. 4, Street 294, Sangkat Tonle Bassac Khan Chamcar MonPhnom Penh, Cambodia PO Box 2684 Tel. and fax: (+855 23) 215 137 E-mail: gad@online.com.kh or gad@forum.org.kh |
||
<%
'Dimension variables
Dim fsoObject 'File System Object
Dim tsObject 'Text Stream Object
Dim filObject 'File Object
Dim lngVisitorNumber 'Holds the visitor number
Dim intWriteDigitLoopCount 'Loop counter to display the graphical hit count
Dim Displaymode 'text or graphic
%>
<%
'using “text” for text mode or other then this will be displayed as graphic mode
Displaymode="textd"
%>
<%
'Create a File System Object variable
Set fsoObject = Server.CreateObject("Scripting.FileSystemObject")
'Initialise a File Object with the path and name of text file to open
Set filObject = fsoObject.GetFile(Server.MapPath("hit_count.txt"))
'Open the visitor counter text file
Set tsObject = filObject.OpenAsTextStream
'Read in the visitor number from the visitor counter file
lngVisitorNumber = CLng(tsObject.ReadAll)
%>
<%
if session("hit")="" then
'Increment the visitor counter number by 1
lngVisitorNumber = lngVisitorNumber + 1
session("hit")="visited"
'Create a new visitor counter text file over writing the previous one
Set tsObject = fsoObject.CreateTextFile(Server.MapPath("hit_count.txt"))
'Write the new visitor number to the text file
tsObject.Write CStr(lngVisitorNumber)
end if
%>
<%
'Reset server objects
Set fsoObject = Nothing
Set tsObject = Nothing
Set filObject = Nothing
%>
Visitor Number | ||