<%
ForReading=1
ForWriting=2
whichfile=server.mappath("/scripts/graffiti/marfi.dat")
countname=server.mappath("/scripts/graffiti/counter.dat")
Set fs = CreateObject("Scripting.FileSystemObject")
Set fc = CreateObject("Scripting.FileSystemObject")
Set thisfile = fs.OpenTextFile(whichfile, ForReading, False,0)
Set countfile=fc.OpenTextFile(countname, ForReading, False)
cntstr=countfile.readline
counter=CInt(cntstr)
countfile.Close
set fc=nothing
newcounter=counter+1
do while not thisfile.AtEndOfStream and not counter=0
thisline=thisfile.readline
if thisline="@@" then
counter=counter-1
end if
loop
if thisfile.AtEndOfStream then
Set thisfile=fs.OpenTextFile(whichfile, ForReading)
do while not thisline="@@"
thisline=thisfile.readline
loop
newcounter=2
end if
thisline=thisfile.readline
do while not thisline="@@"
response.write thisline
thisline=thisfile.readline
if not thisline="@@" then
response.write " "
end if
loop
Set fc = CreateObject("Scripting.FileSystemObject")
Set countfile=fc.OpenTextFile(countname, ForWriting, False)
countfile.write(newcounter)
countfile.Close
set fc=nothing
thisfile.Close
set fs=nothing
%>
|