⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 max.asp

📁 在线报价程序V0.1 免费版: 1、后台添加产品 2、后台分类 3、后台添加友情连接 4、会员管理 5、客户留言 6、在线订单 7、捆绑了《忠网广告管理系统》 8、公告发布、管理 管理员:admin
💻 ASP
字号:
<%
' 1、保存IP个数
SaveIP		= 10

' 2、数据文件名
DataFile	= "../max.txt"

' 3、创建FSO(对象)的字符串
FSOstr		= "Scripting.FileSystemObject"

' 4、统计器名称
CountName	= "毒爱访问统计"

' 忽略所有错误
on error resume next

' 得到本文件的名字
mename=Request.ServerVariables("SCRIPT_NAME")

' 数据文件的绝对路径
thedatafile=server.MapPath(datafile)

tpage=Request("tpage")
select case tpage

'***************************************************************
'                                                       查看页面

case "view"

'创建FSO对象,如果不支持FSO,则转入错误页
Set FSO = CreateObject(FSOstr)
If Err<>0 then Response.Redirect mename & "?tpage=nofso"

' 检查数据文件是否存在
infile=fso.FileExists(thedatafile)


%>
<%
if infile then
	set thefile=fso.OpenTextFile(thedatafile)
	stroldfile=thefile.readall
	thefile.close
	set thefile=nothing
	
	'分解数据文件,获得数据
	vstr=split(stroldfile,vbcrlf)
	
	'访问天数、平均每天访问量
	vdays=now()-cdate(vstr(4))
	vdayavg=vstr(1)/vdays
	vdays=int((vdays*10^3)+0.5)/10^3
	if vdays<1 then vdays="0" & vdays
	vdayavg=int((vdayavg*10^3)+0.5)/10^3
%>
<table border="0" cellpadding="0" cellspacing="0" align=center>
	<tr height="18">
		<td align=left>总访问数</td>
		<td align=left>&nbsp;<font color="#ff0000"><%=vstr(1)%></font>│</td>
		<td align=left>今日访问数</td>
		<td align=left>&nbsp;<font color="#ff0000"><%=vstr(2)%></font>│</td>
		<td align=left>昨日访问数</td>
		<td align=left>&nbsp;<font color="#ff0000"><%=vstr(3)%></font>│</td>
		<td align=left>最高日访问量</td>
		<td align=left>&nbsp;<font color="#ff0000"><%=vstr(7)%></font></td>
	</tr>	
</table>
<%end if%>
<%
case "nofso"
%>
<table width="100%" height="95%">
  <tr>
    <td width="100%" valign=middle>
<table border="0" cellpadding="0" cellspacing="0" align=center>
	<tr height="18">
		<td align=center height=18>对不起,您的服务器不支持FSO组件,无法使用本系统。</td>
	</tr>
</table>
    </td>
  </tr>
</table>
<%
case else

'创建FSO对象,如果不支持FSO,则转入错误页
Set FSO = CreateObject(FSOstr)
If Err<>0 then Response.Redirect mename & "?tpage=nofso"

' 检查数据文件是否存在
infile=fso.FileExists(thedatafile)

' 网页立即过期,防止漏统计
Response.Expires = -1

' 检查客户端IP
vip=Request.ServerVariables("Remote_Addr")

if infile=false then
	vtop=1
	vips=1
	vtoday=1
	vyesterday=0
	vstarttime=now()
	vtodaytime=date()
	vmax=1
	vmaxtime=date()
	SaveStr=vtop & VbCrlf & vips & VbCrlf & vtoday & VbCrlf & vyesterday & VbCrlf & _
		vstarttime & VbCrlf & vtodaytime & vbcrlf & "#" & vip & "#"  & vbcrlf & vmax & vbcrlf & vmaxtime
	'set thefile=fso.OpenTextFile(thedatafile,ForWriting)
	set thefile=fso.CreateTextFile (thedatafile)
	thefile.write(savestr)
	thefile.close
	set thefile=nothing
	set fso=nothing

'如果数据文件本已存在
else
	'先从数据文件中读取数据
	set thefile=fso.OpenTextFile(thedatafile)
	stroldfile=thefile.readall
	thefile.close
	set thefile=nothing
	
	'分解数据文件,获得数据
	vstr=split(stroldfile,vbcrlf)
	
	vtop=vstr(0)
	vips=vstr(1)
	vtoday=vstr(2)
	vyesterday=vstr(3)
	vstarttime=vstr(4)
	vtodaytime=vstr(5)
	vsaveips=vstr(6)
	if ubound(vstr)>7 then
		vmax=vstr(7)
		vmaxtime=vstr(8)
	else
		vmax=0
	end if

	
	'向现有数据中追加值
	vtop=vtop+1
	if instr(vsaveips,"#" & vip & "#")=false then
		vips=vips+1
		if cdate(vtodaytime)=date() then
			vtoday=vtoday+1
		else
			vyesterday=vtoday
			vtoday=1
			vtodaytime=date()
		end if
		if clng(vtoday)>clng(vmax) then
			vmax=vtoday
			vmaxtime=date()
		end if
		vsaveips=left(vsaveips,len(vsaveips)-1)
		vsaveips=right(vsaveips,len(vsaveips)-1)
		howip=split(vsaveips,"#")
		
		if ubound(howip) < SaveIP then
			vsaveips="#" & vsaveips & "#" & vip & "#"
		else
			vsaveips=replace("#" & vsaveips,"#" & howip(0) & "#","#") & "#" & vip & "#"
		end if
	end if
	
	'写入数据文件
	SaveStr=vtop & VbCrlf & vips & VbCrlf & vtoday & VbCrlf & vyesterday & VbCrlf & _
		vstarttime & VbCrlf & vtodaytime & vbcrlf & vsaveips & vbcrlf & vmax & vbcrlf & vmaxtime
	set thefile=fso.CreateTextFile (thedatafile)
	thefile.write(savestr)
	thefile.close
	set thefile=nothing
	set fso=nothing
	
end if
%>
总访问数 <font color="#ff0000"><%=vstr(1)%></font> │
最高日访问量 <font color="#ff0000"><%=vstr(7)%></font> │
昨日访问量 <font color="#ff0000"><%=vstr(3)%></font> │
今日访问量 <font color="#ff0000"><%=vstr(2)%></font>
<%
end select

'检查组件是否被支持的自定义函数
Function IsObj(strObj)
	on error resume next
	IsObj=false
	dim TestObj
	set TestObj=server.CreateObject (strObj)
	If -2147221005 <> Err then
		IsObj = True
		set testobj=nothing
	end if
	isobj=false
End function
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -