tran.asp

来自「新闻发布系统」· ASP 代码 · 共 139 行

ASP
139
字号
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%startime=timer()%>
<!--#include file="const.asp"-->
<!--#include file="inc.asp"-->
<%
	
	'收集需要统计的信息

											
	vIp		= request.ServerVariables("Remote_Addr")							'访问者IP
	vSoft=Request.ServerVariables("HTTP_USER_AGENT")
	vReferer = request("referer")
	iReferer = request("referer")
	if vReferer="" then
		vReferer="直接输入网址进入的"
		iReferer="直接输入网址进入的"
	else	
		vReferer=Mid(vReferer,8)
		vReferer="http://"&Mid(vReferer,1,instr(vReferer,"/"))
	end if
	
	if instr(vSoft,"NetCaptor") then											' 浏览器
		vExplorer="NetCaptor"
	elseif instr(vSoft,"MSIE 6") then
		vExplorer="Internet Explorer 6.x"
	elseif instr(vSoft,"MSIE 5") then
		vExplorer="Internet Explorer 5.x"
	elseif instr(vSoft,"MSIE 4") then
		vExplorer="Internet Explorer 4.x"
	elseif instr(vSoft,"Netscape") then
		vExplorer="Netscape"
	elseif instr(vSoft,"Opera") then
		vExplorer="Opera"
	else
		vExplorer="Other"
	end if
	
	if instr(vSoft,"Windows NT 5.0") then										' 操作系统
		vOS="Windows 2000"
	elseif instr(vSoft,"Windows NT 5.1") then
		vOS="Windows XP"
	elseif instr(vSoft,"Windows NT 5.2") then
		vOS="Windows 2003"
	elseif instr(vSoft,"Windows NT") then
		vOS="Windows NT"
	elseif instr(vSoft,"Windows 9") then
		vOS="Windows 9x"
	elseif instr(vSoft,"unix") or instr(vSoft,"linux") or instr(vSoft,"SunOS") or instr(vSoft,"SunOS") or instr(vSoft,"BSD") or instr(vSoft,"Mac") then 
		vOS="Unix & Unix 类"
	else
		vOS="Other"
	end if
		
	vYear=year(now())          	'年
	vMonth=month(now())        	'月
	vDay=day(now())            	'日
	vHour=hour(now())          	'时
	vTime=now()                	'时间 xxxx-xx-xx xx:xx:xx
	vDate=date()
	vWeekDay=weekday(now())		'星期
	Tp_Ip = vIp	
	Tp_IP = Fn_IP(Tp_Ip)
	'查看Ip所在地区

	vWhereB = GetWhere(Tp_Ip)

	Conn.execute "update flux set refurbish=refurbish+1 where id=1" 		
	
	if request.Cookies("online") <> "true" then
		Set wRs = Server.CreateObject("ADODB.recordset") 
		wRs.open "select cWhere,cCWC from cW where cWhere='"&vWhereB&"'",conn,1,3
		if wRs.eof then
			wRs.AddNew
			wRs("cWhere") = vWhereB
		end if
		wRs("cCWC") = wRs("cCWC")+1
		wRs.Update
		wRs.close
		wRs.open "select cReferer,cCRC from cR where cReferer='"&vReferer&"'",conn,1,3
		if wRs.eof then
			wRs.AddNew
			wRs("cReferer") = vReferer
		end if
		wRs("cCRC") = wRs("cCRC")+1
		wRs.Update
		wRs.close		

		Conn.execute "update cH set cTHC=0 where DATEDIFF('h',HMD,Now()) > 1 and cHour=" & vHour 
		Conn.execute "update cD set cTDC=0 where DATEDIFF('d',DMD,Now()) > 1 and cDay=" & vDay 
		Conn.execute "update cM set cTMC=0 where DATEDIFF('m',MMD,Now()) > 1 and cMonth=" & vMonth 


		Conn.execute "update (select * from (select top 1 * from last20vister order by cCT asc,id asc) as lv,(select * from cM where cMonth=" & vMonth & " ) as lcM,(select * from cD where cDay=" & vDay & " ) as lcD,(select * from cH where cHour=" & vHour & " ) as lcH,(select * from cE where cExplorer='" & vExplorer & "') as lcE,(select * from cO where cOS='" & vOS & "') as lcO ) as c set cCT=now(),cCIP='"&vIp&"',cCOS='"&vOS&"',cCEXP='"&vExplorer&"',cCW='"&vWhereB&"',cCR='"&iReferer&"',cTMC=cTMC+1,cCMC=cCMC+1,MMD=now(),cTDC=cTDC+1,cCDC=cCDC+1,DMD=now(),cTHC=cTHC+1,cCHC=cCHC+1,HMD=now(),cCEC=cCEC+1,cCOC=cCOC+1"
		
		response.Cookies("online") = "true"
		Response.Cookies("online").Expires=DateAdd("h", ExpTime, now()) 
	end if
		
	'1或者没有参数显示图标,0不显示图标,2显示文字
	style = request("style")

	Select Case style
		Case "0"
			c_debug=0

		Case "1",""
			vSql = "select cD.cTDC as todaycount,SumCount.ccount from cD,(select sum(cCMC) as ccount from cM) as SumCount where cD.cDay="&vDay
			Set vRs = GetRs(vSql)
			vCount = vRs("ccount")
			vToday = vRs("todaycount")
			vRs.close

			vTheurl="http://" & Request.ServerVariables("http_host") & Fn_Dir(Request.ServerVariables("url"))
			
			outstr="<a href='" & vTheurl & "index.asp' target='_blank' style='color: #ffffff; text-decoration: none'>"
			outstr=outstr & "<img src='" & vTheurl & "images/mc.gif' border=0 alt='总访问量: " & vCount & " &nbsp;今日访问: " & vToday&" '>"
			outstr=outstr & "</a><br>"

		Case "2"
			vSql = "select cD.cTDC as todaycount,SumCount.ccount from cD,(select sum(cCMC) as ccount from cM) as SumCount where cD.cDay="&vDay
			Set vRs = GetRs(vSql)
			vCount = vRs("ccount")
			vToday = vRs("todaycount")
			vRs.close

			vTheurl="http://" & Request.ServerVariables("http_host") & Fn_Dir(Request.ServerVariables("url"))
			outstr="<a href='" & vTheurl & "index.asp' target='_blank' style='text-decoration: none'>"
			outstr=outstr & "总访问量: " & vCount & " &nbsp;今日访问: " & vToday&""
			outstr=outstr & "</a><br>"

	End Select

	if c_debug=1 then
		endtime=timer()
		outstr = outstr & "统计执行时间:"&FormatNumber((endtime-startime)*1000,3)&"毫秒"
	end if

			Response.Write "document.write(" & chr(34) & outstr & chr(34) & ")"
%>

⌨️ 快捷键说明

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