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

数据库编程

开发平台:

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>24小时信息统计</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. <body bgcolor="#FFFFFF" topmargin="2" leftmargin="2">
  26. <table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" class="table">
  27.   <tr> 
  28.     <td height="28" class="xingmu"><div align="left"><strong>24小时信息统计</strong></div></td>
  29.   </tr>
  30.   <tr>
  31.     <td height="28" class="hback">
  32.       <%
  33. Dim RsHourObj,Sql
  34. Set RsHourObj = Server.CreateObject(G_FS_RS)
  35. Dim MaxVisitCount,VisitTime,VisitHour,CurrentHour
  36. CurrentHour=hour(now())
  37. If G_IS_SQL_DB=0 then
  38. Sql="Select VisitTime From FS_SS_Stat where DATEDIFF('h',VisitTime,Now()) < 24 And DATEDIFF('h',VisitTime,Now()) >=0 "
  39. Else
  40. Sql="Select VisitTime From FS_SS_Stat where DATEDIFF(hour,VisitTime,GetDate()) < 24 And DATEDIFF(hour,VisitTime,GetDate()) >=0 "
  41. End If
  42. RsHourObj.Open Sql,Conn,3,3
  43. MaxVisitCount=0
  44. Dim VisitCount(23),I
  45. for I=0 To 23
  46. VisitCount(I)=0
  47. next
  48. Do While not RsHourObj.Eof 
  49. VisitTime = RsHourObj("VisitTime")
  50. VisitHour = Hour(VisitTime)
  51. for I=0 To 23
  52. if I=VisitHour then
  53. VisitCount(I)=VisitCount(I)+1
  54. end if
  55. next
  56. RsHourObj.MoveNext
  57. Loop
  58. for I=0 To 23
  59. if VisitCount(I)>=MaxVisitCount  then
  60. MaxVisitCount=VisitCount(I)
  61. end if
  62. next
  63. %>
  64.       <% 
  65. Dim VisitSize(23)
  66. For I=0 To 23
  67. if MaxVisitCount<>0 then
  68. VisitSize(I)=100*VisitCount(I)/MaxVisitCount
  69. else
  70. VisitSize(I)=0
  71. end if
  72. Next
  73. %>
  74.       <table border=0 align="center" cellpadding=2>
  75.         <tr> 
  76.           <td align=center>最近24小时统计图表</td>
  77.         </tr>
  78.         <tr> 
  79.           <td align=center><table border="0" cellspacing="0" cellpadding="0">
  80.               <tr> 
  81.                 <td><table border=0 align=center cellpadding=0 cellspacing=0>
  82.                     <tr> 
  83.                       <td height="25" valign=top align="right" nowrap> 
  84.                         <% Response.Write(MaxVisitCount&"次")%>
  85.                       </td>
  86.                     </tr>
  87.                     <tr> 
  88.                       <td  height="25" valign=top align="right"  nowrap> 
  89.                         <% if MaxVisitCount>3 then  
  90. Response.Write(Round(MaxVisitCount*0.75)&"次") 
  91. elseif MaxVisitCount>1  then 
  92. Response.Write((MaxVisitCount-1)&"次") 
  93. else Response.Write("&nbsp;") 
  94. end if
  95. %>
  96.                       </td>
  97.                     </tr>
  98.                     <tr> 
  99.                       <td  height="25" valign=top  align="right" nowrap> 
  100.                         <% if MaxVisitCount>3 then  
  101. Response.Write(Round(MaxVisitCount*0.5)&"次") 
  102. elseif MaxVisitCount>2  then 
  103. Response.Write((MaxVisitCount-2)&"次") 
  104. else Response.Write("&nbsp;") 
  105. end if
  106. %>
  107.                       </td>
  108.                     </tr>
  109.                     <tr> 
  110.                       <td  height="25" valign=top  align="right" nowrap> 
  111.                         <% if MaxVisitCount>3 then 
  112.  Response.Write(Round(MaxVisitCount*0.25)&"次") 
  113. else Response.Write("&nbsp;") 
  114. end if
  115. %>
  116.                       </td>
  117.                     </tr>
  118.                     <tr> 
  119.                       <td  height="31" valign=top  align="right" nowrap>0次</td>
  120.                     </tr>
  121.                   </table></td>
  122.                 <td valign="bottom"> <table align=center>
  123.                     <tr valign=bottom > 
  124.                       <% For I=CurrentHour+1 To 23 %>
  125.                       <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> 
  126.                         <% = I%>
  127.                       </td>
  128.                       <% Next %>
  129.                       <% For I=0 To CurrentHour %>
  130.                       <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> 
  131.                         <% = I%>
  132.                       </td>
  133.                       <% Next %>
  134.                       <td>单位(点)</td>
  135.                     </tr>
  136.                   </table></td>
  137.               </tr>
  138.             </table></td>
  139.         </tr>
  140.       </table>
  141.       <p>&nbsp;</p>
  142.       <%
  143. Dim RsHoursObj
  144. Set RsHoursObj = Server.CreateObject(G_FS_RS)
  145. Sql="Select VisitTime From FS_SS_Stat"
  146. RsHoursObj.Open Sql,Conn,3,3
  147. MaxVisitCount=0
  148. for I=0 To 23
  149. VisitCount(I)=0
  150. next
  151. Do While not RsHoursObj.Eof 
  152. VisitTime = RsHoursObj("VisitTime")
  153. VisitHour = Hour(VisitTime)
  154. for I=0 To 23
  155. if I=VisitHour then
  156. VisitCount(I)=VisitCount(I)+1
  157. end if
  158. next
  159. RsHoursObj.MoveNext
  160. Loop
  161. for I=0 To 23
  162. if VisitCount(I)>=MaxVisitCount  then
  163. MaxVisitCount=VisitCount(I)
  164. end if
  165. next
  166. %>
  167.       <% 
  168. Dim VisitsSize(23),AllCount
  169. AllCount=0
  170. For I=0 To 23
  171. Allcount=AllCount+VisitCount(I)
  172. Next
  173. For I=0 To 23
  174. if VisitCount(I)<>0 then
  175. VisitsSize(I)=100*VisitCount(I)/AllCount
  176. else
  177. VisitsSize(I)=0
  178. end if
  179. Next
  180. %>
  181.       <table border=0 align="center" cellpadding=2>
  182.         <tr> 
  183.           <td align=center>访问量24小时分配图表</td>
  184.         </tr>
  185.         <tr> 
  186.           <td align=center><table border="0" cellspacing="0" cellpadding="0">
  187.               <tr> 
  188.                 <td><table border=0 align=center cellpadding=0 cellspacing=0>
  189.                     <tr> 
  190.                       <td height="25" valign=top align="right" nowrap>100%</td>
  191.                     </tr>
  192.                     <tr> 
  193.                       <td  height="25" valign=top align="right"  nowrap>75%</td>
  194.                     </tr>
  195.                     <tr> 
  196.                       <td  height="25" valign=top  align="right" nowrap>50%</td>
  197.                     </tr>
  198.                     <tr> 
  199.                       <td  height="25" valign=top  align="right" nowrap>25%</td>
  200.                     </tr>
  201.                     <tr> 
  202.                       <td  height="31" valign=top  align="right" nowrap>0</td>
  203.                     </tr>
  204.                   </table></td>
  205.                 <td valign="bottom"> <table align=center>
  206.                     <tr valign=bottom > 
  207.                       <td width="15" align=center nowrap background=../../Images/Visit/tu_back.gif><img src=../Images/bar.gif width="15" height="100" id=htav><br>
  208.                         总</td>
  209.                       <% For I=0 To 23 %>
  210.                       <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> 
  211.                         <% = I%>
  212.                       </td>
  213.                       <% Next %>
  214.                       <td>单位(点)</td>
  215.                     </tr>
  216.                   </table></td>
  217.               </tr>
  218.             </table></td>
  219.         </tr>
  220.       </table></td>
  221.   </tr>
  222. </table>
  223. </body>
  224. </html>
  225. <%
  226. Conn.Close
  227. Set Conn=Nothing
  228. %>