<%
Dim ArticleID,Rs,SQL
Dim AllHits,DayHits,WeekHits,MonthHits,HitsTime,hits,stype
If Not IsNumeric(Request("ArticleID")) And Request("ArticleID") <> "" then
Response.Write"错误的系统参数!ID必须是数字"
Response.End
Else
ArticleID = CLng(Request.querystring("ArticleID"))
End If
stype = CLng(Request.querystring("type"))
If Not IsObject(Conn) Then ConnectionDatabase
Set Rs = Server.CreateObject("ADODB.Recordset")
SQL = "select AllHits,DayHits,WeekHits,MonthHits,HitsTime from NC_Article where ArticleID = "& ArticleID
Rs.Open SQL,Conn,1,3
If Not Rs.EOF Then
hits = CLng(Rs("AllHits"))+1
Rs("AllHits").Value = hits
If DateDiff("Ww", Rs("HitsTime"), Now) <= 0 Then
Rs("WeekHits").Value = Rs("WeekHits").Value + 1
Else
Rs("WeekHits").Value = 1
End If
If DateDiff("M", Rs("HitsTime"), Now) <= 0 Then
Rs("MonthHits").Value = Rs("MonthHits").Value + 1
Else
Rs("MonthHits").Value = 1
End If
If DateDiff("D", Rs("HitsTime"), Now) <= 0 Then
Rs("DayHits").Value = Rs("DayHits").Value + 1
Else
Rs("DayHits").Value = 1
Rs("HitsTime").Value = Now
End If
Rs.Update
AllHits = Rs("AllHits")
DayHits = Rs("DayHits")
WeekHits = Rs("WeekHits")
MonthHits = Rs("MonthHits")
End If
Rs.close
set Rs=nothing
CloseConn
If stype = 1 Then
Response.Write "var oHits=document.getElementById(""ArticleHits"");" & vbNewLine
Response.Write "if (oHits!=null) {" & vbNewLine
Response.Write "oHits.innerHTML="& Chr(34) &"本日:"& DayHits &" 本周:"& WeekHits &" 本月:"& MonthHits &" 总数:"& AllHits &" "& Chr(34) &"" & vbNewLine
Response.Write "}" & vbNewLine
Else
Response.Write "document.write ("& Chr(34) &"本日:"& DayHits &" 本周:"& WeekHits &" 本月:"& MonthHits &" 总数:"& AllHits &" "& Chr(34) &");"
End If
%>
|