asp实现统计访问量的代码


<%
dim count,path
count= 1
path = server.Mappath("count.txt")
Set fs=CreateObject("scripting.filesystemobject")
if(fs.FileExists(path))then
Set hs=fs.opentextfile(path)
count=hs.ReadLine
if session("iscount")="" then
session("iscount")="iscount"
count=count+1
end if
hs.close
Set hs=fs.opentextfile(path,2,true)
hs.writeline(count)
else
Set hs=fs.createtextfile(path)
hs.writeline(1)
end if
response.write "您是第"&count&"位访问者!"
hs.close
set fs=nothing
%>

<%
dim count,path
count= 1
path = server.Mappath("count.txt")
Set fs=CreateObject("scripting.filesystemobject")
if(fs.FileExists(path))then
	Set hs=fs.opentextfile(path)
	count=hs.ReadLine
	if session("iscount")="" then
		session("iscount")="iscount"
		count=count+1
	end if
	hs.close
	Set hs=fs.opentextfile(path,2,true)
	hs.writeline(count)
else
	Set hs=fs.createtextfile(path)
	hs.writeline(1)
end if
response.write "您是第"&count&"位访问者!"
hs.close
set fs=nothing
%>

 非每次刷新都记录!


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM