Index.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_Inc/Function.asp" -->
  5. <%
  6. Response.Buffer = True
  7. Response.Expires = -1
  8. Response.ExpiresAbsolute = Now() - 1
  9. Response.Expires = 0
  10. Response.CacheControl = "no-cache"
  11. Dim Conn,User_Conn,tmp_type,strShowErr,strpage,ShowStr
  12. MF_Default_Conn
  13. MF_IP_Conn
  14. Dim AddrConn,AddrDBC,AddrConnStr,EnAddress
  15. Dim code,VisitIP,vSoft,vExplorer,vOS,EnVisitIP,RsCouObj,RsCouSql,vSource,ExpTime
  16. ExpTime = Conn.Execute("Select ExpTime from FS_SS_SysPara")(0)
  17. code = NoSqlHack(Request("code"))
  18. VisitIP = request.ServerVariables("HTTP_X_FORWARDED_FOR")
  19. If VisitIP = "" then
  20. VisitIP = request.ServerVariables("REMOTE_ADDR")
  21. End If
  22. vSoft = Request.ServerVariables("HTTP_USER_AGENT")
  23. if vSource="" then
  24. vSource="直接输入网址进入的"
  25. else
  26. vSource=Mid(vSource,8)
  27. vSource="http://"&Mid(vSource,1,instr(vSource,"/"))
  28. end if
  29. if instr(vSoft,"NetCaptor") then
  30. vExplorer="NetCaptor"
  31. elseif instr(vSoft,"MSIE 6") then
  32. vExplorer="Internet Explorer 6.x"
  33. elseif instr(vSoft,"MSIE 5") then
  34. vExplorer="Internet Explorer 5.x"
  35. elseif instr(vSoft,"MSIE 4") then
  36. vExplorer="Internet Explorer 4.x"
  37. elseif instr(vSoft,"Netscape") then
  38. vExplorer="Netscape"
  39. elseif instr(vSoft,"Opera") then
  40. vExplorer="Opera"
  41. else
  42. vExplorer="Other"
  43. end if
  44. if instr(vSoft,"Windows NT 5.0") then
  45. vOS="Windows 2000"
  46. elseif instr(vSoft,"Windows NT 5.1") then
  47. vOS="Windows XP"
  48. elseif instr(vSoft,"Windows NT 5.2") then
  49. vOS="Windows 2003"
  50. elseif instr(vSoft,"Windows NT") then
  51. vOS="Windows NT"
  52. elseif instr(vSoft,"Windows 9") then
  53. vOS="Windows 9x"
  54. elseif instr(vSoft,"unix") or instr(vSoft,"linux") or instr(vSoft,"SunOS") or instr(vSoft,"SunOS") or instr(vSoft,"BSD") or instr(vSoft,"Mac") then
  55. vOS="Unix & Unix 类"
  56. else
  57. vOS="Other"
  58. end If
  59. VisitIP = CheckIpSafe(VisitIP)
  60. EnAddress = VisitIP
  61. EnAddress = EnIP(EnAddress)
  62. EnAddress = EnAddr(EnAddress)
  63. Set RsCouObj = Conn.Execute("Select ID from FS_SS_Stat where IP='"&VisitIP&"'")
  64. If RsCouObj.eof then
  65. Response.Cookies("online") = false
  66. End if
  67. RsCouObj.Close
  68. Set RsCouObj = Nothing
  69. If code = "2" then
  70. If request.Cookies("FoosunCookie_stat")("online") <> "true" then
  71. Set RsCouObj = Server.CreateObject(G_FS_RS)
  72. RsCouSql = "Select VisitTime,OSType,ExploreType,IP,OSType,Area,Source,LoginNum from FS_SS_Stat where 1=0"
  73. RsCouObj.Open RsCouSql,Conn,3,3
  74. RsCouObj.AddNew
  75. RsCouObj("VisitTime") = Now()
  76. RsCouObj("OSType") = vOS
  77. RsCouObj("ExploreType") = vExplorer
  78. RsCouObj("IP") = Request.ServerVariables("Remote_Addr")
  79. RsCouObj("OSType") = vOS
  80. RsCouObj("Area") = EnAddress
  81. RsCouObj("Source") = vSource
  82. RsCouObj("LoginNum") = "1"
  83. RsCouObj.Update
  84. RsCouObj.Close
  85. Set RsCouObj = Nothing
  86. Else
  87. Conn.Execute("Update FS_SS_Stat Set LoginNum=LoginNum+1 where IP='"&VisitIP&"' and day(VisitTime)='"&day(now())&"' and month(VisitTime)='"&month(now())&"' and year(VisitTime)='"&year(now())&"'")
  88. End If
  89. dim TempObj,TempObjs,VisitAllNums,VisitTodayNum
  90. Set TempObj = Conn.Execute("Select WebCountTime from FS_SS_SysPara")
  91. If G_IS_SQL_DB=0 then
  92. Set TempObjs = Conn.Execute("Select Count(ID) from FS_SS_Stat where VisitTime>#"&TempObj("WebCountTime")&"#")
  93. Else
  94. Set TempObjs = Conn.Execute("Select Count(ID) from FS_SS_Stat where VisitTime>'"&TempObj("WebCountTime")&"'")
  95. End if
  96. VisitAllNums = Clng(TempObjs(0))
  97. Set TempObjs = Conn.Execute("Select Count(ID) from FS_SS_Stat where day(VisitTime) = '"&Day(Now())&"' and month(VisitTime)='"&Month(Now())&"' and year(VisitTime)='"&Year(Now())&"'")
  98. VisitTodayNum = Clng(TempObjs(0))
  99. TempObjs.Close
  100. Set TempObjs = Nothing
  101. TempObj.Close
  102. Set TempObj = Nothing
  103. ShowStr = "总访问量: " & VisitAllNums & " &nbsp;今日访问: " & VisitTodayNum&""
  104. ElseIf code = "1" then
  105. If request.Cookies("FoosunCookie_stat")("online") <> "true" then
  106. Set RsCouObj = Server.CreateObject(G_FS_RS)
  107. RsCouSql = "Select VisitTime,OSType,ExploreType,IP,Area,Source,LoginNum from FS_SS_Stat where 1=0"
  108. RsCouObj.Open RsCouSql,Conn,3,3
  109. RsCouObj.AddNew
  110. RsCouObj("VisitTime") = Now()
  111. RsCouObj("OSType") = vOS
  112. RsCouObj("ExploreType") = vExplorer
  113. RsCouObj("IP") = Request.ServerVariables("Remote_Addr")
  114. RsCouObj("Area") = EnAddress
  115. RsCouObj("Source") = vSource
  116. RsCouObj("LoginNum") = "1"
  117. RsCouObj.Update
  118. RsCouObj.Close
  119. Set RsCouObj = Nothing
  120. Else
  121. Conn.Execute("Update FS_SS_Stat Set LoginNum=LoginNum+1 where IP='"&VisitIP&"' and day(VisitTime)='"&day(now())&"' and month(VisitTime)='"&month(now())&"' and year(VisitTime)='"&year(now())&"'")
  122. End If
  123. dim  tmp_1
  124. tmp_1 = Replace("/"&G_VIRTUAL_ROOT_DIR &"/stat","//","/")
  125. ShowStr = "<img src='"& tmp_1 &"/Img/mc.gif' border=0 alt='风讯(www.foosun.cn)统计'>"
  126. Else
  127. If request.Cookies("FoosunCookie_stat")("online") <> "true" then
  128. Set RsCouObj = Server.CreateObject(G_FS_RS)
  129. RsCouSql = "Select VisitTime,OSType,ExploreType,IP,OSType,Area,Source,LoginNum from FS_SS_Stat where 1=0"
  130. RsCouObj.Open RsCouSql,Conn,3,3
  131. RsCouObj.AddNew
  132. RsCouObj("VisitTime") = Now()
  133. RsCouObj("OSType") = vOS
  134. RsCouObj("ExploreType") = vExplorer
  135. RsCouObj("IP") = Request.ServerVariables("Remote_Addr")
  136. RsCouObj("OSType") = vOS
  137. RsCouObj("Area") = EnAddress
  138. RsCouObj("Source") = vSource
  139. RsCouObj("LoginNum") = "1"
  140. RsCouObj.Update
  141. RsCouObj.Close
  142. Set RsCouObj = Nothing
  143. Else
  144. Conn.Execute("Update FS_SS_Stat Set LoginNum=LoginNum+1 where IP='"&VisitIP&"' and day(VisitTime)='"&day(now())&"' and month(VisitTime)='"&month(now())&"' and year(VisitTime)='"&year(now())&"'")
  145. End If
  146. ShowStr = ""
  147. End If
  148. Response.Cookies("FoosunCookie_stat")("online") = "true"
  149. Response.Cookies("FoosunCookie_stat").Expires = DateAdd("n", ExpTime, now())
  150. Response.Write "document.write(" & chr(34) & ShowStr & chr(34) & ")"
  151. function EnIP(ip)
  152. dim ip1,ip2,ip3,ip4
  153. ip=cstr(ip)
  154. ip1=left(ip,cint(instr(ip,".")-1))
  155. ip=mid(ip,cint(instr(ip,".")+1))
  156. ip2=left(ip,cint(instr(ip,".")-1))
  157. ip=mid(ip,cint(instr(ip,".")+1))
  158. ip3=left(ip,cint(instr(ip,".")-1))
  159. ip4=mid(ip,cint(instr(ip,".")+1))
  160. EnIP=cint(ip1)*256*256*256+cint(ip2)*256*256+cint(ip3)*256+cint(ip4)
  161. end function
  162. Function EnAddr(IP)
  163. Dim EnAddrObj
  164.     Set EnAddrObj = AddrConn.Execute("select Country,City from Address where StarIP <= "&IP&" and EndIP >= "&IP&"")
  165. if Not EnAddrObj.Eof then
  166. EnAddr = EnAddrObj("Country")&EnAddrObj("City")
  167. else
  168. EnAddr = "未知区域"
  169. end if
  170. EnAddrObj.close
  171. Set EnAddrObj = Nothing
  172. End Function
  173. Set AddrConn = Nothing
  174. Set Conn = Nothing
  175. %>