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

数据库编程

开发平台:

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. <body  topmargin="2" leftmargin="2">
  26. <table width="98%" height="56" border="0" align="center" cellpadding="5" cellspacing="1" class="table">
  27.   <tr> 
  28.     <td height="28" class="xingmu"><div align="left"><strong>访问者来源统计</strong></div></td>
  29.   </tr>
  30.   <tr>
  31.     <td height="28" class="hback">
  32.       <%
  33. Dim RsIPObj,Sql,NumUnkown,page_size,page_no,page_total,record_all
  34. Set RsIPObj = Server.CreateObject(G_FS_RS)
  35. Sql="Select distinct Area,IP From FS_SS_Stat"
  36. RsIPObj.Open Sql,Conn,3,3
  37. Dim IP(),Area(),I
  38. I=1
  39. Redim IP(1),Area(1)
  40. Do While not RsIPObj.Eof
  41. IP(I)=RsIPObj("IP")
  42. Area(I)=RsIPObj("Area")
  43. RsIPObj.MoveNext
  44. I=I+1
  45. Redim Preserve IP(I),Area(I)
  46. Loop
  47. RsIPObj.Close
  48. Sql="Select Count(*) As RecordNum From FS_SS_Stat"
  49. RsIPObj.Open Sql,Conn,3,3
  50. Dim RecordNum
  51. RecordNum=RsIPObj("RecordNum")
  52. RsIPObj.Close
  53. Sql="Select LoginNum From FS_SS_Stat"
  54. RsIPObj.open sql,conn,3,3
  55. Dim AllNum
  56. AllNum=0
  57. do while not RsIPObj.eof
  58. AllNum=AllNum+Cint(RsIPObj("LoginNum"))
  59. RsIPObj.movenext
  60. loop
  61. page_size=50
  62. page_no=request.querystring("page_no")
  63. if page_no<=1 or page_no="" then page_no=1
  64. if ((UBound(IP)-1) mod page_size)=0 then
  65. page_total=(UBound(IP)-1)page_size
  66. else
  67. page_total=(UBound(IP)-1)page_size+1
  68. end if
  69. %>
  70.       <table width=100% border=0 align="center" cellpadding=2>
  71.         <tr> 
  72.           <td align=center>访问者来源统计图表</td>
  73.         </tr>
  74.         <tr> 
  75.           <td align=center>
  76.   <table align=center>
  77.               <tr valign=cente> 
  78.                 <td valign="middle" nowap> <div align="left">共</div></td>
  79.                 <td align=left background=../../Images/Visit/tu_back_2.gif valign=middle width=150><img src=../Images/bar2.gif width="150" height=15></td>
  80.                 <td valign="middle" nowap>
  81.                   <% = AllNum %>
  82.                   次</td>
  83.                 <td valign="middle" nowap>&nbsp;</td>
  84.                 <%
  85. for I=(page_no*page_size-page_size+1) to page_no*page_size
  86. if I>UBound(IP) then exit for
  87. if IP(i)<>"" then
  88. %>
  89.               <tr valign=bottom > 
  90.                 <td valign="middle" nowap><div align="left">
  91.                     <% =IP(i) %>
  92.                   </div></td>
  93.                 <td align=left background=../../Images/Visit/tu_back_2.gif valign=middle width=150><img src=../Images/bar2.gif width="
  94. <% 
  95. RsIPObj.close
  96.     Sql="select LoginNum from FS_SS_Stat where IP='"& IP(i)&"'"
  97.     RsIPObj.open Sql,conn,3,3
  98.     dim a
  99.     a=0
  100. do while not RsIPObj.eof
  101.     a=a+Cint(RsIPObj("LoginNum"))
  102.     RsIPObj.movenext
  103.     loop
  104.    response.Write(150*a/AllNum)
  105. %>
  106. " height=15></td>
  107.                 <td valign="middle" nowap> 
  108.                   <%
  109.    response.Write(a)
  110.    %>
  111.                   次&nbsp;&nbsp;</td>
  112.                 <td valign="middle" nowap><font color="red">(<%=Area(I)%>)</font></td>
  113.               </tr>
  114.               <%
  115. else
  116. end if
  117. Next
  118. if cint(page_no) = cint(page_total) then
  119. %>
  120.               <tr valign=cente> 
  121.                 <td valign="middle" nowap><div align="left">未知</div></td>
  122.                 <td align=left background=../../Images/Visit/tu_back_2.gif valign=middle width=150><img src=../Images/bar2.gif width="
  123. <% if AllNum<>0  then
  124. Response.Write(150*NumUnkown/AllNum)
  125. else
  126. Response.Write(0)
  127. end if
  128. %>
  129. " height=15></td>
  130.                 <td valign="middle" nowap>
  131.                   <% = NumUnkown %>
  132.                   次</td>
  133.                 <td valign="middle" nowap>&nbsp;</td>
  134.                 <% end if %>
  135.             </table>
  136.             <%if page_total>1 then%>
  137.             <table width="100%" border="0" cellspacing="0" cellpadding="0">
  138.               <tr> 
  139.                 <td valign="middle"> <div align="right"></div>
  140.                   <div align="right"></div>
  141.                   <div align="right"> 
  142.                     <% =  "NO.<b>"& page_no &"</b>,&nbsp;&nbsp;" %>
  143.                     <% = "Totel:<b>"& page_total &"</b>,&nbsp;RecordCount:<b>" & record_all &"</b>&nbsp;&nbsp;&nbsp;"%>
  144.                   </div></td>
  145.                 <td width="15%" valign="bottom"><div align="center"> 
  146. <%
  147. if page_total=1 then
  148. response.Write "&nbsp;<img src=../images/First1.gif border=0 alt=首页></img>&nbsp;"
  149. response.Write "&nbsp;<img src=../images/prePage.gif border=0 alt=上一页></img>&nbsp;"
  150. response.Write "&nbsp;<img src=../images/nextPage.gif border=0 alt=下一页></img>&nbsp;"
  151. response.Write "&nbsp;<img src=../images/endPage.gif border=0 alt=尾页></img>&nbsp;"
  152. else
  153. if cint(page_no)<>1 and cint(page_no)<>page_total then
  154. response.Write "&nbsp;<a href=?page_no=1>首页</a>&nbsp;"
  155. response.Write "&nbsp;<a href=?page_no="&cstr(cint(page_no)-1)&">上一页</a>&nbsp;"
  156. response.Write "&nbsp;<a href=?page_no="&cstr(cint(page_no)+1)&">下一页</a>&nbsp;"
  157. response.Write "&nbsp;<a href=?page_no="& page_total &">最后一页</a>&nbsp;"
  158. elseif cint(page_no)=1 then
  159. response.Write "&nbsp;首页</a>&nbsp;"
  160. response.Write "&nbsp;上一页&nbsp;"
  161. response.Write "&nbsp;<a href=?page_no="&cstr(cint(page_no)+1)&">下一页</a>&nbsp;"
  162. response.Write "&nbsp;<a href=?page_no="& page_total &">最后一页</a>&nbsp;"
  163. else
  164. response.Write "&nbsp;<a href=?page_no=1>首页&nbsp;"
  165. response.Write "&nbsp;<a href=?page_no="&cstr(cint(page_no)-1)&">上一页</a>&nbsp;"
  166. response.Write "&nbsp;下一页</a>&nbsp;"
  167. response.Write "&nbsp;最后一页&nbsp;"
  168. end if
  169. end if
  170. %>
  171.                     <select onChange="ChangePage(this.value);" style="width:50;" name="select">
  172.                       <% for i=1 to page_total %>
  173.                       <option <% if cint(page_no) = i then Response.Write("selected")%> value="<% = i %>"> 
  174.                       <% = i %>
  175.                       </option>
  176.                       <% next %>
  177.                     </select>
  178.                   </div></td>
  179.               </tr>
  180.             </table>
  181.             <%end if%>
  182.       </table></td>
  183.   </tr>
  184. </table>
  185. </body>
  186. </html>
  187. <script language="JavaScript">
  188. function ChangePage(PageNum)
  189. {
  190. window.location.href='?page_no='+PageNum;
  191. }
  192. function PriPage()
  193. {
  194. var PageNum='<% = cint(page_no) - 1 %>';
  195. ChangePage(PageNum);
  196. }
  197. function NextPage()
  198. {
  199. var PageNum='<% = cint(page_no) + 1 %>';
  200. ChangePage(PageNum);
  201. }
  202. </script> 
  203. <%
  204. set conn=nothing
  205. RsIPObj.close
  206. set RsIPObj=nothing
  207. %>