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

数据库编程

开发平台:

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 RsMonthObj,Sql
  44. Set RsMonthObj = Server.CreateObject(G_FS_RS)
  45. Dim MaxVisitCount,VisitTime,VisitMonth,CurrentMonth
  46. CurrentMonth=Month(Now())
  47. If G_IS_SQL_DB=0 then
  48. Sql="Select VisitTime From FS_AD_Source where DATEDIFF('m',VisitTime,Now()) < 12 And DATEDIFF('m',VisitTime,Now()) >=0 and AdID="&AdID&""
  49. Else
  50. Sql="Select VisitTime From FS_AD_Source where DATEDIFF(month,VisitTime,GetDate()) < 12 And DATEDIFF(month,VisitTime,GetDate()) >=0 and AdID="&AdID&""
  51. End If
  52. RsMonthObj.Open Sql,Conn,3,3
  53. MaxVisitCount=0
  54. Dim VisitNum(12),I
  55. for I=1 To 12
  56. VisitNum(I)=0
  57. next
  58. Do While not RsMonthObj.Eof 
  59. VisitTime = RsMonthObj("VisitTime")
  60. VisitMonth = Month(VisitTime)
  61. for I=1 To 12
  62. if I=VisitMonth then
  63. VisitNum(I)=VisitNum(I)+1
  64. end if
  65. next
  66. RsMonthObj.MoveNext
  67. Loop
  68. for I=1 To 12
  69. if VisitNum(I)>=MaxVisitCount  then
  70. MaxVisitCount=VisitNum(I)
  71. end if
  72. next
  73. %>
  74. <% 
  75. Dim VisitSize(12)
  76. For I=1 To 12
  77. if MaxVisitCount<>0 then
  78. VisitSize(I)=100*VisitNum(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>最近12个月统计图表</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> 
  94.                   <% Response.Write(MaxVisitCount&"次")%>
  95.                </td>
  96.               </tr>
  97.               <tr> 
  98.                 <td  height="25" valign=top align="right"  nowrap>
  99. <% if MaxVisitCount>3 then  
  100. Response.Write(Round(MaxVisitCount*0.75)&"次") 
  101. elseif MaxVisitCount>1  then 
  102. Response.Write((MaxVisitCount-1)&"次") 
  103. else Response.Write("&nbsp;") 
  104. end if
  105. %> 
  106. </td>
  107.               </tr>
  108.               <tr> 
  109.                 <td  height="25" valign=top  align="right" nowrap>
  110. <% if MaxVisitCount>3 then  
  111. Response.Write(Round(MaxVisitCount*0.5)&"次") 
  112. elseif MaxVisitCount>2  then 
  113. Response.Write((MaxVisitCount-2)&"次") 
  114. else Response.Write("&nbsp;") 
  115. end if
  116. %>
  117. </td>
  118.               </tr>
  119.               <tr>
  120.                 <td  height="25" valign=top  align="right" nowrap>
  121.                 <% if MaxVisitCount>3 then 
  122.  Response.Write(Round(MaxVisitCount*0.25)&"次") 
  123. else Response.Write("&nbsp;") 
  124. end if
  125. %>
  126. </td>
  127.               </tr>
  128.               <tr> 
  129.                 <td  height="31" valign=top  align="right" nowrap>0次</td>
  130.               </tr>
  131.             </table></td>
  132.           <td valign="bottom">
  133. <table align=center>
  134.               <tr valign=bottom > 
  135.   <% if CurrentMonth =12 then %>
  136.                 <% For I=1 To 12 %>
  137.                 <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>
  138.                   <% = I%>
  139.                 </td>
  140.                 <% Next %>
  141. <% else %>
  142.                 <% For I=CurrentMonth+1 To 12 %>
  143.                 <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>
  144.                   <% = I%>
  145.                 </td>
  146.                 <% Next %>
  147.                 <% For I=1 To CurrentMonth  %>
  148.                 <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>
  149.                   <% = I%>
  150.                 </td>
  151.                 <% Next %>
  152. <% end if %>
  153.                 <td>单位(月)</td>
  154.               </tr>
  155.             </table></td>
  156.         </tr>
  157.       </table> </td>
  158. </tr>
  159. </table>
  160. <p> </p>
  161. <%
  162. Dim RsMonthsObj
  163. Set RsMonthsObj = Server.CreateObject(G_FS_RS)
  164. Sql="Select VisitTime From FS_AD_Source where AdID="&AdID&""
  165. RsMonthsObj.Open Sql,Conn,3,3
  166. MaxVisitCount=0
  167. for I=1 To 12
  168. VisitNum(I)=0
  169. next
  170. Do While not RsMonthsObj.Eof 
  171. VisitTime = RsMonthsObj("VisitTime")
  172. VisitMonth = Month(VisitTime)
  173. for I=1 To 12
  174. if I=VisitMonth then
  175. VisitNum(I)=VisitNum(I)+1
  176. end if
  177. next
  178. RsMonthsObj.MoveNext
  179. Loop
  180. for I=1 To 12
  181. if VisitNum(I)>=MaxVisitCount  then
  182. MaxVisitCount=VisitNum(I)
  183. end if
  184. next
  185. %>
  186. <% 
  187. Dim VisitsSize(12),AllCount
  188. AllCount=0
  189. For I=1 To 12
  190. Allcount=AllCount+VisitNum(I)
  191. Next
  192. For I=0 To 12
  193. if VisitNum(I)<>0 then
  194. VisitsSize(I)=100*VisitNum(I)/AllCount
  195. else
  196. VisitsSize(I)=0
  197. end if
  198. Next
  199. %>
  200. <table border=0 align="center" cellpadding=2>
  201. <tr>
  202. <td align=center>访问量12个月分配图表</td>
  203. </tr>
  204. <tr>
  205.     <td align=center><table border="0" cellspacing="0" cellpadding="0">
  206.         <tr>
  207.           <td><table border=0 align=center cellpadding=0 cellspacing=0>
  208.               <tr> 
  209.                 <td height="25" valign=top align="right" nowrap>100%</td>
  210.               </tr>
  211.               <tr> 
  212.                 <td  height="25" valign=top align="right"  nowrap>75%</td>
  213.               </tr>
  214.               <tr> 
  215.                 <td  height="25" valign=top  align="right" nowrap>50%</td>
  216.               </tr>
  217.               <tr>
  218.                 <td  height="25" valign=top  align="right" nowrap>25%</td>
  219.               </tr>
  220.               <tr> 
  221.                 <td  height="31" valign=top  align="right" nowrap>0</td>
  222.               </tr>
  223.             </table></td>
  224.           <td valign="bottom">
  225. <table align=center>
  226.               <tr valign=bottom >
  227.                 <td width="15" align=center nowrap background=../images/tu_back.gif><img src=/admin/Images/bar.gif width="15" height="100" id=htav><br>
  228.                   总</td>
  229.                 <% For I=1 To 12 %>
  230.                 <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>
  231.                   <% = I%>
  232.                 </td>
  233.                 <% Next %>
  234.                 <td>单位(月)</td>
  235.               </tr>
  236.             </table></td>
  237.         </tr>
  238.       </table> </td>
  239. </tr>
  240. </table>
  241. </body>
  242. </html>
  243. <%
  244. Conn.Close
  245. Set Conn=Nothing
  246. %><!-- Powered by: FoosunCMS4.0系列,Company:Foosun Inc. -->