当前位置:编程学习 > asp >>

如何让计数器只对新进用户计数?

答案:

如何让计数器只对新进用户计数?

<script language=vbscript runat=server>

sub application_onstart

filepath=server.mappath("/count")

filename=filepath+"\counter.txt"

set fs=createobject("scripting.filesystemobject")

if not fs.fileexists(filename) then

fs.createtextfile(filename)

set f=fs.getfile(filename)

s=1

Set ts = f.OpenAsTextStream(2, -2)

ts.writeline(cstr(s))

ts.close

else

set f=fs.getfile(filename)

Set ts = f.OpenAsTextStream(1, -2)

s=ts.readline+1

ts.close

end if

application(“visitor”)=s

end sub

sub session_onstart

session.timeout=5

application("visitor ")=application("visitor ")+1

set f=fs.getfile(filename)

Set ts = f.OpenAsTextStream(2, -2)

ts.writeline (cstr(application("visitor ")))

ts.close

end sub

</script>

<%

s=cstr(application("visitor")+10^6)

s=mid(s,2,6)

for i=1 to 6

response.write "<img src='flashdays/liyanbing/images/"

&mid(s,i,1)&".gif' width='18' height='25'>"

next

%>

[1]

上一个:如何编制一个产生随机密码的函数?
下一个:如何计算出当前日期属于定义时间段内的第几星期?

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,