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

📄 counter.asp

📁 庐江二中
💻 ASP
字号:
<!--#include file="conn.asp" -->
<!--#include file="const.asp"-->
<%
dim mode,gif,TotalUser,TotalNUser,Totaltodays,TotalNews,TotalClick,TotalSpecial,N
mode = LCASE(Request("mode"))
gif  = Request("gif")

if ShowTotalUser=1 then		'判断是否显示用户总数
	sql="select * from Users"
	rs.Open sql,conn,1,1
	TotalUser =INT(RS.recordcount)
	rs.close
	response.write "document.write(""注册会员:"");"
	response.write "document.write("""&GCounter( TotalUser )&"<br>"");"
end if

if ShowNewUser=1 then		'判断是否显示新用户总数
	sql="select id FROM Users where addDate > '"&date&" 00:00:00' and addDate <'"&date&" 23:59:00'"
	rs.Open sql,conn,1,1
	TotalNUser =INT(RS.recordcount)
	rs.close
	response.write "document.write(""最新会员:"");"
	response.write "document.write("""&GCounter( TotalNUser )&"<br>"");"
end if

if ShowTotalNews=1 then		'判断是否显示文章总数
	sql="Select NewsID,click from News Where updatetime > '"&date&" 00:00:00' and updatetime <'"&date&" 23:59:00'"
	rs.Open sql,conn,1,1
	Totaltodays =INT(RS.recordcount)
	rs.close
	response.write "document.write(""今日文章:"");"
	response.write "document.write("""&GCounter( Totaltodays )&"<br>"");"
	
	sql="select NewsID from news"
	rs.Open sql,conn,1,1
	TotalNews =INT(RS.recordcount)
	rs.close
	response.write "document.write(""文章总数:"");"
	response.write "document.write("""&GCounter( TotalNews )&"<br>"");"
		
	sql="select sum(click) from news"
	rs.Open sql,conn,1,1
	TotalClick =rs(0)
	rs.close
	response.write "document.write(""点击总数:"");"
	response.write "document.write("""&GCounter( TotalClick )&"<br>"");"
end if


if ShowTotalSpecial=1 then	'判断是否显示专题总数
	sql="select * from special"
	rs.Open sql,conn,1,1
	TotalSpecial =INT(RS.recordcount)
	rs.close
	response.write "document.write(""专题总数:"");"
	response.write "document.write("""&GCounter( TotalSpecial )&"<br>"");"
end if

Rs.Open "Select * From counters" ,conn,1,3
dim LASTIP,NEWIP
if session("IsFirst")="" then		'判断是否是第一次登陆,如果是则计数器加一
LASTIP = RS("LASTIP")
NEWIP = REQUEST.servervariables("REMOTE_ADDR")

IF CSTR(Month(RS("DATE"))) <> CSTR(Month(DATE())) THEN
RS("DATE") = DATE()
RS("YESTERDAY") = RS("TODAY")
RS("BMONTH") = RS("MONTH")
RS("MONTH") = 1
RS("TODAY") = 1
RS.Update
ELSE
IF CSTR(Day(RS("DATE"))) <> CSTR(Day(DATE())) THEN
RS("DATE") = DATE()
RS("YESTERDAY") = RS("TODAY")
RS("TODAY") = 1
RS.Update
END IF
END IF

RS("TOTAL")  =  RS("TOTAL") + 1
RS("TODAY") =  RS("TODAY") + 1
RS("MONTH")  =  RS("MONTH") + 1
RS.Update
session("IsFirst")=true
end if

dim D1,D2,D3
N = Now
D1 =  StartDate                                                    ' 开始统计日期(年/月/日)
D2 = DateValue(N)
D3 = DateDiff("d", D1, D2)

if ShowTotalView=1 then
response.write "document.write(""浏览总数:"");"
	response.write "document.write("""&GCounter(RS("TOTAL"))&"<br>"");"
end if
if ShowTodayView=1 then
response.write "document.write(""今日浏览:"");"
	response.write "document.write("""&GCounter(RS("TODAY"))&"<br>"");"
end if
if ShowYesterdayView=1 then
response.write "document.write(""昨日浏览:"");"
	response.write "document.write("""&GCounter( RS("YESTERDAY"))&"<br>"");"
end if
if ShowMonthView=1 then
response.write "document.write(""本月浏览:"");"
	response.write "document.write("""&GCounter( RS("MONTH") )&"<br>"");"
end if
if ShowBMonthView=1 then
response.write "document.write(""上月浏览:"");"
	response.write "document.write("""&GCounter( RS("BMONTH") )&"<br>"");"
end if
if ShowTotalDate=1 then
N = Now
D2 = DateValue(N)
response.write "document.write(""开站天数:"");"
	response.write "document.write("""&GCounter( DateDiff("d", D1, D2) )&"<br>"");"
end if
if ShowAverageView=1 then
D3 = DateDiff("d", D1, D2)
response.write "document.write(""平均人数:"");"
if D3=0 then
response.write "document.write("""&GCounter(RS("TOTAL"))&""");"
else
response.write "document.write("""&GCounter(RS("TOTAL")\D3)&""");"
end if
end if
rs.Close
response.end
set rs=nothing
conn.close
set conn=nothing

Function GCounter( counter )
Dim S, i, G
S = CStr( counter )

For i = 1 to Len(S)
G = G & "<IMG SRC=images/counter/" & Mid(S, i, 1) & ".gif Align=middle>"
Next
response.write "document.write("""&G&""");"
End Function
%>

⌨️ 快捷键说明

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