Visit_DaysStatistic.asp
Upload User: jisenq
Upload Date: 2014-06-29
Package Size: 7216k
Code Size: 8k
Category:

ADO-ODBC

Development Platform:

ASP/ASPX

  1. <% Option Explicit %>
  2. <!--#include file="../../FS_Inc/Const.asp" -->
  3. <!--#include file="../../FS_Inc/Function.asp"-->
  4. <!--#include file="../../FS_InterFace/MF_Function.asp" -->
  5. <!--#include file="../../FS_InterFace/NS_Function.asp" -->
  6. <%'Copyright (c) 2006 Foosun Inc. Code by 邓西
  7. Dim AdID,strShowErr,AdName
  8. AdID=Request.QueryString("ID")
  9. AdName=Request.QueryString("AdName")
  10. If AdID="" or IsNull(AdID) Then
  11. strShowErr = "<li>参数错误!</li>"
  12. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  13. Response.end
  14. Else
  15. If Isnumeric(AdID)=False Then
  16. strShowErr = "<li>参数错误!</li>"
  17. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  18. Response.end
  19. End If
  20. AdID=Clng(AdID)
  21. End If
  22. response.buffer=true
  23. Response.CacheControl = "no-cache"
  24. Dim Conn,User_Conn
  25. MF_Default_Conn
  26. MF_Session_TF 
  27. if not MF_Check_Pop_TF("AS_site") then Err_Show
  28. if not MF_Check_Pop_TF("AS002") then Err_Show
  29. %>
  30. <html>
  31. <head>
  32. <title>按日信息统计</title>
  33. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  34. </head>
  35. <link href="../images/skin/Css_<%=Session("Admin_Style_Num")%>/<%=Session("Admin_Style_Num")%>.css" rel="stylesheet" type="text/css">
  36. <body bgcolor="#FFFFFF" topmargin="2" leftmargin="2">
  37. <table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" class="table">
  38.   <tr class="hback"> 
  39.     <td>以下是[<font color="red"><%=AdName%></font>]的 按日信息统计  |  <a href="javascript:history.back();">返回上一级</a></td>
  40.   </tr>
  41. </table>
  42. <%
  43. Dim RsDayObj,Sql
  44. Set RsDayObj = Server.CreateObject(G_FS_RS)
  45. Dim MaxVisitCount,VisitTime,VisitDay,CurrentDay
  46. CurrentDay=Day(Now())
  47. Dim DaysOfMonth
  48. if Month(Now())=1 then
  49. DaysOfMonth=GetDayNum(Year(Now())-1, 12)
  50. else
  51. DaysOfMonth=GetDayNum(Year(Now()), Month(Now())-1)
  52. end if
  53. If G_IS_SQL_DB=0 then
  54. Sql="Select VisitTime From FS_AD_Source where DATEDIFF('d',VisitTime,Now()) <= " & DaysOfMonth & " And DATEDIFF('d',VisitTime,Now()) >=0 and AdID="&AdID&""
  55. Else
  56. Sql="Select VisitTime From FS_FlowStatistic where DATEDIFF(day,VisitTime,GetDate()) <= " & DaysOfMonth & " And DATEDIFF(day,VisitTime,GetDate()) >=0 and AdID="&AdID&""
  57. End If
  58. RsDayObj.Open Sql,Conn,3,3
  59. MaxVisitCount=0
  60. Dim VisitNum(31),I
  61. for I=1 To DaysOfMonth
  62. VisitNum(I)=0
  63. next
  64. Do While not RsDayObj.Eof 
  65. VisitTime = RsDayObj("VisitTime")
  66. VisitDay = Day(VisitTime)
  67. for I=1 To DaysOfMonth
  68. if I=VisitDay then
  69. VisitNum(I)=VisitNum(I)+1
  70. end if
  71. next
  72. RsDayObj.MoveNext
  73. Loop
  74. for I=1 To DaysOfMonth
  75. if VisitNum(I)>=MaxVisitCount  then
  76. MaxVisitCount=VisitNum(I)
  77. end if
  78. next
  79. %>
  80. <% 
  81. Dim VisitSize(31)
  82. For I=1 To DaysOfMonth
  83. if MaxVisitCount<>0 then
  84. VisitSize(I)=100*VisitNum(I)/MaxVisitCount
  85. else
  86. VisitSize(I)=0
  87. end if
  88. Next
  89. %>
  90. <table border=0 align="center" cellpadding=2 >
  91. <tr>
  92. <td align=center>最近<% =DaysOfMonth %>天统计图表</td>
  93. </tr>
  94. <tr>
  95.     <td align=center><table border="0" cellspacing="0" cellpadding="0">
  96.         <tr>
  97.           <td><table border=0 align=center cellpadding=0 cellspacing=0>
  98.               <tr> 
  99.                 <td height="25" valign=top align="right" nowrap> 
  100.                   <% Response.Write(MaxVisitCount&"次")%>
  101.                </td>
  102.               </tr>
  103.               <tr> 
  104.                 <td  height="25" valign=top align="right"  nowrap>
  105. <% if MaxVisitCount>3 then  
  106. Response.Write(Round(MaxVisitCount*0.75)&"次") 
  107. elseif MaxVisitCount>1  then 
  108. Response.Write((MaxVisitCount-1)&"次") 
  109. else Response.Write("&nbsp;") 
  110. end if
  111. %> 
  112. </td>
  113.               </tr>
  114.               <tr> 
  115.                 <td  height="25" valign=top  align="right" nowrap>
  116. <% if MaxVisitCount>3 then  
  117. Response.Write(Round(MaxVisitCount*0.5)&"次") 
  118. elseif MaxVisitCount>2  then 
  119. Response.Write((MaxVisitCount-2)&"次") 
  120. else Response.Write("&nbsp;") 
  121. end if
  122. %>
  123. </td>
  124.               </tr>
  125.               <tr>
  126.                 <td  height="25" valign=top  align="right" nowrap>
  127.                 <% if MaxVisitCount>3 then 
  128.  Response.Write(Round(MaxVisitCount*0.25)&"次") 
  129. else Response.Write("&nbsp;") 
  130. end if
  131. %>
  132. </td>
  133.               </tr>
  134.               <tr> 
  135.                 <td  height="31" valign=top  align="right" nowrap>0次</td>
  136.               </tr>
  137.             </table></td>
  138.           <td valign="bottom">
  139. <table align=center>
  140.               <tr valign=bottom > 
  141.                 <% For I=CurrentDay+1 To DaysOfMonth %>
  142.                 <td width="15" align=center nowrap background=../../Images/Visit/tu_back.gif><img src=/admin/Images/bar.gif width="15" height="<% =VisitSize(I) %>" id=htav><br>
  143.                   <% = I%>
  144.                 </td>
  145.                 <% Next %>
  146.                 <% For I=1 To CurrentDay  %>
  147.                 <td width="15" align=center nowrap background=../../Images/Visit/tu_back.gif><img src=/admin/Images/bar.gif width="15" height="<% =VisitSize(I) %>" id=htav><br>
  148.                   <% = I%>
  149.                 </td>
  150.                 <% Next %>
  151.                 <td>单位(日)</td>
  152.               </tr>
  153.             </table></td>
  154.         </tr>
  155.       </table> </td>
  156. </tr>
  157. </table>
  158. <p> </p>
  159. <%
  160. Dim RsDaysObj
  161. Set RsDaysObj = Server.CreateObject(G_FS_RS)
  162. Sql="Select VisitTime From FS_AD_Source Where AdID="&AdID&""
  163. RsDaysObj.Open Sql,Conn,3,3
  164. MaxVisitCount=0
  165. for I=1 To 30
  166. VisitNum(I)=0
  167. next
  168. Do While not RsDaysObj.Eof 
  169. VisitTime = RsDaysObj("VisitTime")
  170. VisitDay = Day(VisitTime)
  171. for I=1 To 31
  172. if I=VisitDay then
  173. VisitNum(I)=VisitNum(I)+1
  174. end if
  175. next
  176. RsDaysObj.MoveNext
  177. Loop
  178. for I=1 To 31
  179. if VisitNum(I)>=MaxVisitCount  then
  180. MaxVisitCount=VisitNum(I)
  181. end if
  182. next
  183. %>
  184. <% 
  185. Dim VisitsSize(31),AllCount
  186. AllCount=0
  187. For I=1 To 31
  188. Allcount=AllCount+VisitNum(I)
  189. Next
  190. For I=0 To 31
  191. if VisitNum(I)<>0 then
  192. VisitsSize(I)=100*VisitNum(I)/AllCount
  193. else
  194. VisitsSize(I)=0
  195. end if
  196. Next
  197. %>
  198. <table border=0 align="center" cellpadding=2>
  199. <tr>
  200. <td align=center>访问量各天分配图表</td>
  201. </tr>
  202. <tr>
  203.     <td align=center><table border="0" cellspacing="0" cellpadding="0">
  204.         <tr>
  205.           <td><table border=0 align=center cellpadding=0 cellspacing=0>
  206.               <tr> 
  207.                 <td height="25" valign=top align="right" nowrap>100%</td>
  208.               </tr>
  209.               <tr> 
  210.                 <td  height="25" valign=top align="right"  nowrap>75%</td>
  211.               </tr>
  212.               <tr> 
  213.                 <td  height="25" valign=top  align="right" nowrap>50%</td>
  214.               </tr>
  215.               <tr>
  216.                 <td  height="25" valign=top  align="right" nowrap>25%</td>
  217.               </tr>
  218.               <tr> 
  219.                 <td  height="31" valign=top  align="right" nowrap>0</td>
  220.               </tr>
  221.             </table></td>
  222.           <td valign="bottom">
  223. <table align=center>
  224.               <tr valign=bottom >
  225.                 <td width="15" align=center nowrap background=../../Images/Visit/tu_back.gif><img src=/admin/Images/bar.gif width="15" height="100" id=htav><br>
  226.                   总</td>
  227.                 <% For I=1 To 31 %>
  228.                 <td width="15" align=center nowrap background=../../Images/Visit/tu_back.gif><img src=/admin/Images/bar.gif width="15" height="<% =VisitsSize(I) %>" id=htav><br>
  229.                   <% = I%>
  230.                 </td>
  231.                 <% Next %>
  232.                 <td>单位(日)</td>
  233.               </tr>
  234.             </table></td>
  235.         </tr>
  236.       </table> </td>
  237. </tr>
  238. </table>
  239. </body>
  240. </html>
  241. <%
  242. Conn.Close
  243. Set Conn=Nothing
  244. Function GetDayNum(YearVar, MonthVar)
  245.     Dim Temp, LeapYear, BigMonthArray, i, BigMonth
  246.     BigMonthArray = Array(1, 3, 5, 7, 8, 10, 12)
  247.     YearVar = CInt(YearVar)
  248.     MonthVar = CInt(MonthVar)
  249.     Temp = CInt(YearVar / 4)
  250.     If YearVar = Temp * 4 Then
  251.         LeapYear = True
  252.     Else
  253.         LeapYear = False
  254.     End If
  255.     For i = LBound(BigMonthArray) To UBound(BigMonthArray)
  256.         If MonthVar = BigMonthArray(i) Then
  257.             BigMonth = True
  258.             Exit For
  259.         Else
  260.             BigMonth = False
  261.         End If
  262.     Next
  263.     If BigMonth = True Then
  264.         GetDayNum = 31
  265.     Else
  266.         If MonthVar = 2 Then
  267.             If LeapYear = True Then
  268.                 GetDayNum = 29
  269.             Else
  270.                 GetDayNum = 28
  271.             End If
  272.         Else
  273.             GetDayNum = 30
  274.         End If
  275.     End If
  276. End Function
  277. Set Conn=Nothing
  278. %><!-- Powered by: FoosunCMS4.0系列,Company:Foosun Inc. -->