开放源码-访客统计查询(五)


所属类别:Asp

文章作者:佚名

特别推荐:免费发布信息 承包关键词~~抢爆了!HOT!


<%Function DealIP(srcIP) Dim lngIP, aryIP, I lngIP = 0 aryIP = Split(srcIP, ".") If UBound(aryIP) <> 3 Then DealIP = 0 Exit Function End If

For I = 0 To 3 lngIP = lngIP + (CInt(aryIP(I)) * (256 ^ (3 - I))) Next

DealIP = lngIP - 1 If Err Then DealIP = 0End Function<!--METADATA TYPE="typelib" uuid="00000205-0000-0010-8000-00AA006D2EA4" -->Sub Statistics_Add() Session("IsRecorded") = False

Session("sttPage") = Request.ServerVariables("SCRIPT_NAME") Session("refPage") = Request.ServerVariables("HTTP_REFERER")

If Not Session("IsRecorded") Then Dim objConn, objRS, strSQL Dim IEVersion, IPAddress, VisitDate, VisitTime, IPAddressDeal, tmpID Dim sttPage, refPage

IEVersion = Request.ServerVariables("HTTP_USER_AGENT") IPAddress = Request.ServerVariables("REMOTE_ADDR") VisitDate = Date() VisitTime = Time() sttPage = Session("sttPage") refPage = Session("refPage")

Set objConn = Server.CreateObject("ADODB.Connection") With objConn ' 数据库连接,字符串自定 .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("... ...") .Open End With

IPAddressDeal = DealIP(CStr(IPAddress)) Set objRS = Server.CreateObject("ADODB.Recordset") With objRS .ActiveConnection = objConn .CursorType = adOpenForwardOnly .LockType = adLockReadOnly .Source = "Select * From IPDatas Where IP_Lower <= " & IPAddressDeal & " And IP_Upper >= " & IPAddressDeal .Open End With If objRS.EOF Then tmpID = 29510 Else tmpID = objRS("IP_ID") End If objRS.Close

With objRS .ActiveConnection = objConn .CursorType = adOpenForwardOnly .LockType = adLockPessimistic .Source = "Select * From IPs" .Open .AddNew .Fields.Item("IEVersion") = IEVersion .Fields.Item("IPAddress") = IPAddress .Fields.Item("IP_ID") = tmpID .Fields.Item("VisitDate") = VisitDate .Fields.Item("VisitTime") = VisitTime .Fields.Item("sttPage") = sttPage .Fields.Item("refPage") = refPage .Update End With

objRS.Close Set objRS = Nothing objConn.Close Set objConn = Nothing

Session("IsRecorded") = True End IfEnd SubSub Application_OnStart() Application("NowOnline") = 0End SubSub Session_OnStart() Session.TimeOut = 20 Session("IsRecordedCCCNet") = False

Call Statistics_Add

Application.Lock Application("NowOnline") = Application("NowOnline") + 1 Application.UnLockEnd SubSub Session_OnEnd() Application.Lock Application("NowOnline") = Application("NowOnline") - 1 Application.UnLockEnd Sub%> 关闭本页

相关信息

· XML和数据库

· 详解嗅探原理与反嗅探技术

· winform实现的仿Msn移动提示信息窗口

· Linux系统下http服务不能解释php的问题








....

120080 85163