本站提供最佳源码解析对象服务,欢迎转载和分享。

【2468游戏源码】【源码辅助器】【相亲婚恋源码】ip统计源码_ip统计代码

2024-11-15 01:21:20 来源:cdn贝源码 分类:探索

1.网站数据统计中pv、统计统计uv、源码ip的代码区别
2.vb 如何实现统计 IP

ip统计源码_ip统计代码

网站数据统计中pv、uv、统计统计2468游戏源码ip的源码区别

       做网站,数据统计不可或缺。代码安装统计代码,统计统计可了解网站流量。源码

       网站流量统计中有PV、代码UV、统计统计IP三项数据。源码源码辅助器新入门的代码SEO者,常混淆这三者的统计统计区别。接下来,源码我将解析它们。代码

       首先,相亲婚恋源码来了解三者定义:

       IP指独立IP数,小时内相同公网IP只算一次。

       PV是Page View缩写,即页面浏览量或点击量,每次刷新,手机源码tobPV计数。

       UV是Unique Visitor缩写,指访问网站的每台电脑客户端,:-:内相同客户端只计一次。

       明白了定义,httpd发布源码三者的区别清晰可见:

       IP统计的是某IP地址计算机访问网站次数,真实,衡量网站流量。

       PV反映浏览网站的页面数,每次刷新,PV增加。PV与来访者数量成正比,但不反映实际来访者数量。

       UV统计访问网站的电脑数量,通过浏览器缓存判断来访者身份。更换IP但不清除cookies,UV数不变。

       总结,IP与UV数据相似,IP反映网络地址数量,UV对应实际浏览者数量。统计局限于互联网,本地网站无法统计。

vb 如何实现统计 IP

       GetIpAddrTable ByVal 0&, Ret, True

       If Ret <= 0 Then Exit Sub

       ReDim bBytes(0 To Ret - 1) As Byte

       GetIpAddrTable bBytes(0), Ret, False

       CopyMemory Listing.dEntrys, bBytes(0), 4

       CopyMemory Listing.mIPInfo(0), bBytes(4), Len(Listing.mIPInfo(0))

       '在这里取得IP

       T_ip.Text = ConvertAddressToString(Listing.mIPInfo(0).dwAddr)

       -------------------------------------------------------------------------

       Public Declare Function GetIpAddrTable Lib "IPHlpApi" (pIPAdrTable As Byte, pdwSize As Long, ByVal Sort As Long) As Long

       Public Declare Sub CopyMemory Lib "kernel" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)

       Const MAX_IP = 5

       Type IPINFO

        dwAddr As Long

        dwIndex As Long

        dwMask As Long

        dwBCastAddr As Long

        dwReasmSize As Long

        unused1 As Integer

        unused2 As Integer

       End Type

       Type MIB_IPADDRTABLE

        dEntrys As Long

        mIPInfo(MAX_IP) As IPINFO

       End Type

       Type IP_Array

        mBuffer As MIB_IPADDRTABLE

        BufferLen As Long

       End Type

       Public Function ConvertAddressToString(longAddr As Long) As String

        Dim MyByte(3) As Byte

        Dim Cnt As Long

        CopyMemory MyByte(0), longAddr, 4

        For Cnt = 0 To 3

        ConvertAddressToString = ConvertAddressToString + CStr(MyByte(Cnt)) + "."

        Next Cnt

        ConvertAddressToString = Left$(ConvertAddressToString, Len(ConvertAddressToString) - 1)

       End Function

       ã€yadianer】:

       ä»…仅是针对本机,最简单的办法是用winsock了,如楼上

       ä¸‹é¢æ˜¯ç”¨API

        侦测目前设备上所使用的 IP 地址

        ' 设定在您的计算机上,最多可能使用 5 组 IP 地址,并且用来产生缓冲区

        Private Const MAX_IP =

        Private Type IPINFO

        dwAddr As Long ' IP 地址

        dwNICIndex As Long ' NIC 界面索引

        dwSubnetMask As Long ' 子网掩码

        dwBroadCastAddr As Long ' 封包广播地址

        dwReAssemblySize As Long ' 组译大小

        unused1 As Integer ' 暂不使用

        unused2 As Integer ' 暂不使用

        End Type

        Private Type MIB_IPADDRTABLE

        dwEntrys As Long ' 窗体中登录的数量

        arIPInfo(MAX_IP) As IPINFO ' IP 地址登录数组

        End Type

        Private Type IP_Array

        mBuffer As MIB_IPADDRTABLE ' IP 地址清单数组

        BufferLen As Long ' 缓冲区长度

        End Type

        Private Declare Sub CopyMemory Lib "kernel" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)

        Private Declare Function GetIpAddrTable Lib "IPHlpApi" (pIPAdrTable As Byte, pdwSize As Long, ByVal Sort As Long) As Long

        ' 将长整数转换为字符串

        Public Function ConvertAddr2Str(LongAddress As Long) As String

        Dim addrByte(3) As Byte

        Dim Cnt As Long

        CopyMemory addrByte(0), LongAddress, 4

        For Cnt = 0 To 3

        ConvertAddr2Str = ConvertAddr2Str + CStr(addrByte(Cnt)) + "."

        Next Cnt

        ConvertAddr2Str = Left$(ConvertAddr2Str, Len(ConvertAddr2Str) - 1)

        End Function

        Private Sub Form_Load()

        Text1.Text = ""

        Me.Caption = "取得计算机上所使用的 IP 地址"

        Text1.Font.Size =

        Start

        End Sub

        Private Sub Form_Resize()

        Text1.Height = Me.Height - * Screen.TwipsPerPixelY

        Text1.Width = Me.Width - * Screen.TwipsPerPixelX

        End Sub

        Private Sub Start()

        Dim lRet As Long, I As Long

        Dim Buffer() As Byte

        Dim ListDatas As MIB_IPADDRTABLE

        Text1 = ""

        On Error GoTo Errors

        GetIpAddrTable ByVal 0&, lRet, True

        If lRet <= 0 Then Exit Sub

        ReDim Buffer(0 To lRet - 1) As Byte

        ' 取回 IP 地址的相关数据

        GetIpAddrTable Buffer(0), lRet, False

        Debug.Print Buffer(0)

        ' 利用已经安装 IP 地址的前四个字节,来取得登录的信息

        CopyMemory ListDatas.dwEntrys, Buffer(0), 4

        Text1 = "在您的计算机上,共有 " & ListDatas.dwEntrys & " 组已经设定使用的 IP 地址" & vbCrLf

        Text1 = Text1 & String(, "=") & vbCrLf

        For I = 0 To ListDatas.dwEntrys - 1

        ' 将存在内存之中的地址结构,复制到清单之中

        CopyMemory ListDatas.arIPInfo(I), Buffer(4 + (I * Len(ListDatas.arIPInfo(0)))), Len(ListDatas.arIPInfo(I))

        Text1 = Text1 & "IP 地址 :" & ConvertAddr2Str(ListDatas.arIPInfo(I).dwAddr) & vbCrLf

        Text1 = Text1 & "IP 子网掩码:" & ConvertAddr2Str(ListDatas.arIPInfo(I).dwSubnetMask) & vbCrLf

        Text1 = Text1 & "IP 广播地址 :" & ConvertAddr2Str(ListDatas.arIPInfo(I).dwBroadCastAddr) & vbCrLf

        Text1 = Text1 & String(, "*") & vbCrLf & vbCrLf

        Next

        Exit Sub

        Errors:

        End Sub

       ã€yadianer】:

       å¦‚果是针外网,可以用下面的:原理是根据访问网页得到

       Private Const ERROR_SUCCESS As Long = 0

       Private Const MAX_ADAPTER_NAME_LENGTH As Long =

       Private Const MAX_ADAPTER_DESCRIPTION_LENGTH As Long =

       Private Const MAX_ADAPTER_ADDRESS_LENGTH As Long = 8

       Private Type IP_ADDRESS_STRING

        IpAddr(0 To ) As Byte

       End Type

       Private Type IP_MASK_STRING

        IpMask(0 To ) As Byte

       End Type

       Private Type IP_ADDR_STRING

        dwNext As Long

        IpAddress As IP_ADDRESS_STRING

        IpMask As IP_MASK_STRING

        dwContext As Long

       End Type

       Private Type IP_ADAPTER_INFO

        dwNext As Long

        ComboIndex As Long 'reserved

        sAdapterName(0 To (MAX_ADAPTER_NAME_LENGTH + 3)) As Byte

        sDescription(0 To (MAX_ADAPTER_DESCRIPTION_LENGTH + 3)) As Byte

        dwAddressLength As Long

        sIPAddress(0 To (MAX_ADAPTER_ADDRESS_LENGTH - 1)) As Byte

        dwIndex As Long

        uType As Long

        uDhcpEnabled As Long

        CurrentIpAddress As Long

        IpAddressList As IP_ADDR_STRING

        GatewayList As IP_ADDR_STRING

        DhcpServer As IP_ADDR_STRING

        bHaveWins As Long

        PrimaryWinsServer As IP_ADDR_STRING

        SecondaryWinsServer As IP_ADDR_STRING

        LeaseObtained As Long

        LeaseExpires As Long

       End Type

       Private Declare Function GetAdaptersInfo Lib "iphlpapi.dll" _

        (pTcpTable As Any, _

        pdwSize As Long) As Long

       Private Declare Sub CopyMemory Lib "kernel" _

        Alias "RtlMoveMemory" _

        (dst As Any, _

        src As Any, _

        ByVal bcount As Long)

       Private Declare Function URLDownloadToFile Lib "urlmon" _

        Alias "URLDownloadToFileA" _

        (ByVal pCaller As Long, _

        ByVal szURL As String, _

        ByVal szFileName As String, _

        ByVal dwReserved As Long, _

        ByVal lpfnCB As Long) As Long

       Private Declare Function DeleteUrlCacheEntry Lib "Wininet.dll" _

        Alias "DeleteUrlCacheEntryA" _

        (ByVal lpszUrlName As String) As Long

       Private Declare Function lstrlenW Lib "kernel" _

        (ByVal lpString As Long) As Long

       Private Sub Form_Load()

        Command1.Caption = "Get Public IP"

        Text1.Text = LocalIPAddress()

        Text2.Text = ""

       End Sub

       Private Sub Command1_Click()

        Text2.Text = GetPublicIP()

       End Sub

       Private Function GetPublicIP()

        Dim sSourceUrl As String

        Dim sLocalFile As String

        Dim hfile As Long

        Dim buff As String

        Dim pos1 As Long

        Dim pos2 As Long

        'site returning IP address

        sSourceUrl = ".mvps.org/resources/tools/getpublicip.shtml"

        sLocalFile = "c:\ip.txt"

        'ensure this file does not exist in the cache

        Call DeleteUrlCacheEntry(sSourceUrl)

        'download the public IP file,

        'read into a buffer and delete

        If DownloadFile(sSourceUrl, sLocalFile) Then

        hfile = FreeFile

        Open sLocalFile For Input As #hfile

        buff = Input$(LOF(hfile), hfile)

        Close #hfile

       'look for the IP line

        pos1 = InStr(buff, "var ip =")

        'if found,

        If pos1 Then

        'get position of first and last single

        'quotes around address (e.g. '...')

        pos1 = InStr(pos1 + 1, buff, "'", vbTextCompare) + 1

        pos2 = InStr(pos1 + 1, buff, "'", vbTextCompare) '- 1

        'return the IP address

        GetPublicIP = Mid$(buff, pos1, pos2 - pos1)

        Else

        GetPublicIP = "(unable to parse IP)"

        End If 'pos1

        Kill sLocalFile

        Else

        GetPublicIP = "(unable to access shtml page)"

        End If 'DownloadFile

       End Function

       Private Function DownloadFile(ByVal sURL As String, _

        ByVal sLocalFile As String) As Boolean

        DownloadFile = URLDownloadToFile(0, sURL, sLocalFile, 0, 0) = ERROR_SUCCESS

       End Function

       Private Function LocalIPAddress() As String

        Dim cbRequired As Long

        Dim buff() As Byte

        Dim ptr1 As Long

        Dim sIPAddr As String

        Dim Adapter As IP_ADAPTER_INFO

        Call GetAdaptersInfo(ByVal 0&, cbRequired)

        If cbRequired > 0 Then

        ReDim buff(0 To cbRequired - 1) As Byte

        If GetAdaptersInfo(buff(0), cbRequired) = ERROR_SUCCESS Then

        'get a pointer to the data stored in buff()

        ptr1 = VarPtr(buff(0))

        Do While (ptr1 <> 0)

        'copy the data from the pointer to the

        'first adapter into the IP_ADAPTER_INFO type

        CopyMemory Adapter, ByVal ptr1, LenB(Adapter)

        With Adapter

        'the DHCP IP address is in the

        'IpAddress.IpAddr member

        sIPAddr = TrimNull(StrConv(.IpAddressList.IpAddress.IpAddr, vbUnicode))

        If Len(sIPAddr) > 0 Then Exit Do

        ptr1 = .dwNext

        End With 'With Adapter

        'ptr1 is 0 when (no more adapters)

        Loop 'Do While (ptr1 <> 0)

        End If 'If GetAdaptersInfo

        End If 'If cbRequired > 0

        'return any string found

        LocalIPAddress = sIPAddr

       End Function

       Private Function TrimNull(startstr As String) As String

        TrimNull = Left$(startstr, lstrlenW(StrPtr(startstr)))

       End Function

【本文网址:http://5o.net.cn/html/8d230597686.html 欢迎转载】

copyright © 2016 powered by 皮皮网   sitemap