hitcount.asp

来自「功能介绍: 一、会员功能模块 1、站内短信发布(设计中) 2、书架收藏夹」· ASP 代码 · 共 120 行

ASP
120 行
字号
<!-- #include file="conn.asp" -->
<%
Function bookcount(id)
if session("book_ID")<>"" then 
if session("book_ID")<>cstr(id) then
dim yearhitstime,monthhitstime,weekdayhitstime,dayhitstime
set rshit=server.CreateObject("ADODB.recordset")
sqlhit="select yearhitstime,monthhitstime,weekdayhitstime,dayhitstime,list_hit,list_yhit,list_mhit,list_zhit,list_dhit from [list_book] where id="&cstr(id)
rshit.open sqlhit,conn,1,3
if not rshit.eof then
yearhitstime=rshit("yearhitstime")
monthhitstime=rshit("monthhitstime")
weekdayhitstime=rshit("weekdayhitstime")
dayhitstime=rshit("dayhitstime")
end if
rshit("list_hit")=rshit("list_hit")+1
rshit.update

if cstr(year(date()))=cstr(year(yearhitstime)) then
rshit("list_yhit")=rshit("list_yhit")+1
rshit.update
else
rshit("list_yhit")=1
rshit("yearhitstime")=now()
rshit.update
end if

if cstr(month(date()))=cstr(month(monthhitstime)) then
rshit("list_mhit")=rshit("list_mhit")+1
rshit.update
else
rshit("list_mhit")=1
rshit("monthhitstime")=now()
rshit.update
end if

if cstr(weekday(date()))=cstr(weekday(weekdayhitstime)) then
rshit("list_zhit")=rshit("list_zhit")+1
rshit.update
else
rshit("list_zhit")=1
rshit("weekdayhitstime")=now()
rshit.update
end if

if cstr(day(date()))=cstr(day(dayhitstime)) then
rshit("list_dhit")=rshit("list_dhit")+1
rshit.update
else
rshit("list_dhit")=1
rshit("dayhitstime")=now()
rshit.update
end if
rshit.close
set rshit=nothing
else
end if
else
set rshit=server.CreateObject("ADODB.recordset")
sqlhit="select yearhitstime,monthhitstime,weekdayhitstime,dayhitstime,list_hit,list_yhit,list_mhit,list_zhit,list_dhit from [list_book] where id="&cstr(id)
rshit.open sqlhit,conn,1,3
if not rshit.eof then
yearhitstime=rshit("yearhitstime")
monthhitstime=rshit("monthhitstime")
weekdayhitstime=rshit("weekdayhitstime")
dayhitstime=rshit("dayhitstime")
end if
rshit("list_hit")=rshit("list_hit")+1
rshit.update

if cstr(year(date()))=cstr(year(yearhitstime)) then
rshit("list_yhit")=rshit("list_yhit")+1
rshit.update
else
rshit("list_yhit")=1
rshit("yearhitstime")=now()
rshit.update
end if

if cstr(month(date()))=cstr(month(monthhitstime)) then
rshit("list_mhit")=rshit("list_mhit")+1
rshit.update
else
rshit("list_mhit")=1
rshit("monthhitstime")=now()
rshit.update
end if

if cstr(weekday(date()))<>1 then
rshit("list_zhit")=rshit("list_zhit")+1
rshit.update
else
rshit("list_zhit")=1
rshit("weekdayhitstime")=now()
rshit.update
end if

if cstr(day(date()))=cstr(day(dayhitstime)) then
rshit("list_dhit")=rshit("list_dhit")+1
rshit.update
else
rshit("list_dhit")=1
rshit("dayhitstime")=now()
rshit.update
end if
rshit.close
set rshit=nothing
session("book_ID")=cstr(id)
end if
End Function

id=CheckSql(trim(request("id")))
bookcount(id)
if makeJS=1 then
temdj(djNum)
temmdj(mdjNum)
temzdj(zdjNum)
temddj(ddjNum)
end if
%>

⌨️ 快捷键说明

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