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

数据库编程

开发平台:

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>24小时信息统计</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>]的 24小时统计  |  <a href="javascript:history.back();">返回上一级</a></td>
  40.   </tr>
  41. </table>
  42. <%
  43. Dim RsHourObj,Sql
  44. Set RsHourObj = Server.CreateObject(G_FS_RS)
  45. Dim MaxVisitCount,VisitTime,VisitHour,CurrentHour
  46. CurrentHour=hour(now())
  47. If G_IS_SQL_DB=0 then
  48. Sql="Select VisitTime From FS_AD_Source where DATEDIFF('h',VisitTime,Now()) < 24 And DATEDIFF('h',VisitTime,Now()) >=0 and AdID="&AdID&""
  49. Else
  50. Sql="Select VisitTime From FS_AD_Source where DATEDIFF(hour,VisitTime,GetDate()) < 24 And DATEDIFF(hour,VisitTime,GetDate()) >=0 and AdID="&AdID&""
  51. End If
  52. RsHourObj.Open Sql,Conn,3,3
  53. MaxVisitCount=0
  54. Dim VisitCount(23),I
  55. for I=0 To 23
  56. VisitCount(I)=0
  57. next
  58. Do While not RsHourObj.Eof 
  59. VisitTime = RsHourObj("VisitTime")
  60. VisitHour = Hour(VisitTime)
  61. for I=0 To 23
  62. if I=VisitHour then
  63. VisitCount(I)=VisitCount(I)+1
  64. end if
  65. next
  66. RsHourObj.MoveNext
  67. Loop
  68. for I=0 To 23
  69. if VisitCount(I)>=MaxVisitCount  then
  70. MaxVisitCount=VisitCount(I)
  71. end if
  72. next
  73. %>
  74. <% 
  75. Dim VisitSize(23)
  76. For I=0 To 23
  77. if MaxVisitCount<>0 then
  78. VisitSize(I)=100*VisitCount(I)/MaxVisitCount
  79. else
  80. VisitSize(I)=0
  81. end if
  82. Next
  83. %>
  84. <table border=0 align="center" cellpadding=2>
  85. <tr>
  86. <td align=center>最近24小时统计图表</td>
  87. </tr>
  88. <tr>
  89.     <td align=center><table border="0" cellspacing="0" cellpadding="0">
  90.         <tr>
  91.           <td><table border=0 align=center cellpadding=0 cellspacing=0>
  92.               <tr> 
  93.                 <td height="25" valign=top align="right" nowrap> <% 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">
  132. <table align=center>
  133.               <tr valign=bottom >
  134.                 <% For I=CurrentHour+1 To 23 %>
  135.                 <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>
  136.                   <% = I%>
  137.                 </td>
  138.                 <% Next %>
  139.                 <% For I=0 To CurrentHour %>
  140.                 <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>
  141.                   <% = I%>
  142.                 </td>
  143.                 <% Next %>
  144.                 <td>单位(点)</td>
  145.               </tr>
  146.             </table></td>
  147.         </tr>
  148.       </table> </td>
  149. </tr>
  150. </table>
  151. <p> </p>
  152. <%
  153. Dim RsHoursObj
  154. Set RsHoursObj = Server.CreateObject(G_FS_RS)
  155. Sql="Select VisitTime From FS_AD_Source where AdID="&AdID&""
  156. RsHoursObj.Open Sql,Conn,3,3
  157. MaxVisitCount=0
  158. for I=0 To 23
  159. VisitCount(I)=0
  160. next
  161. Do While not RsHoursObj.Eof 
  162. VisitTime = RsHoursObj("VisitTime")
  163. VisitHour = Hour(VisitTime)
  164. for I=0 To 23
  165. if I=VisitHour then
  166. VisitCount(I)=VisitCount(I)+1
  167. end if
  168. next
  169. RsHoursObj.MoveNext
  170. Loop
  171. for I=0 To 23
  172. if VisitCount(I)>=MaxVisitCount  then
  173. MaxVisitCount=VisitCount(I)
  174. end if
  175. next
  176. %>
  177. <% 
  178. Dim VisitsSize(23),AllCount
  179. AllCount=0
  180. For I=0 To 23
  181. Allcount=AllCount+VisitCount(I)
  182. Next
  183. For I=0 To 23
  184. if VisitCount(I)<>0 then
  185. VisitsSize(I)=100*VisitCount(I)/AllCount
  186. else
  187. VisitsSize(I)=0
  188. end if
  189. Next
  190. %>
  191. <table border=0 align="center" cellpadding=2>
  192. <tr>
  193. <td align=center>访问量24小时分配图表</td>
  194. </tr>
  195. <tr>
  196.     <td align=center><table border="0" cellspacing="0" cellpadding="0">
  197.         <tr>
  198.           <td><table border=0 align=center cellpadding=0 cellspacing=0>
  199.               <tr> 
  200.                 <td height="25" valign=top align="right" nowrap>100%</td>
  201.               </tr>
  202.               <tr> 
  203.                 <td  height="25" valign=top align="right"  nowrap>75%</td>
  204.               </tr>
  205.               <tr> 
  206.                 <td  height="25" valign=top  align="right" nowrap>50%</td>
  207.               </tr>
  208.               <tr>
  209.                 <td  height="25" valign=top  align="right" nowrap>25%</td>
  210.               </tr>
  211.               <tr> 
  212.                 <td  height="31" valign=top  align="right" nowrap>0</td>
  213.               </tr>
  214.             </table></td>
  215.           <td valign="bottom">
  216. <table align=center>
  217.               <tr valign=bottom >
  218.                 <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>
  219.                   总</td>
  220.                 <% For I=0 To 23 %>
  221.                 <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>
  222.                   <% = I%>
  223.                 </td>
  224.                 <% Next %>
  225.                 <td>单位(点)</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. %><!-- Powered by: FoosunCMS4.0系列,Company:Foosun Inc. -->