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