Statistical <%
<script Language = "VBScript" RunAt = "Server" >
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 = 0
End 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
' Database connection, string self-determined
. 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 >=" & Ipaddressdea L
. 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 If
End Sub
Sub Application_OnStart ()
Application ("nowonline") = 0
End Sub
Sub Session_OnStart ()
Session.Timeout = 20
Session ("isrecordedcccnet") = False
Call Statistics_add
Application.Lock
Application ("nowonline") = Application ("Nowonline") + 1
Application.UnLock
End Sub
Sub Session_OnEnd ()
Application.Lock
Application ("nowonline") = Application ("Nowonline")-1
Application.UnLock
End Sub
</Script>
%>