Visit_DaysStatistic.asp
上传用户:jisenq
上传日期:2014-06-29
资源大小:7216k
文件大小:9k
源码类别:

数据库编程

开发平台:

ASP/ASPX

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