ASP調(diào)用純真IP庫實例(3)_ASP教程
教程Tag:暫無Tag,歡迎添加,賺取U幣!
推薦:ASP實例:ASP實現(xiàn)空間的最近訪客由于工作關(guān)系,在做一個用戶空間。要用到空間的最近訪客,見ASP代碼: % username=request.QueryString(username) '地欄中的username,就是自己的用戶名了 if trim(request.Cookies(user_name)) Then '首頁要判斷該訪問是否登陸,只有登陸的訪問才能記
' ============================================
' 獲取結(jié)束IP位置
' ============================================
Private Function GetEndIP()
Stream.Position = EndIPOff
Buf = Stream.Read(5)
EndIP = AscB(MidB(Buf, 1, 1)) + (AscB(MidB(Buf, 2, 1))*256) + (AscB(MidB(Buf, 3, 1))*256*256) + (AscB(MidB(Buf, 4, 1))*256*256*256)
CountryFlag = AscB(MidB(Buf, 5, 1))
GetEndIP = EndIP
End Function
' ============================================
' 獲取地域信息,包含國家和和省市
' ============================================
Private Sub GetCountry(IP)
If (CountryFlag = 1 Or CountryFlag = 2) Then
Country = GetFlagStr(EndIPOff + 4)
If CountryFlag = 1 Then
LocalStr = GetFlagStr(Stream.Position)
' 以下用來獲取數(shù)據(jù)庫版本信息
If IP >= IPToInt("255.255.255.0") And IP <= IPToInt("255.255.255.255") Then
LocalStr = GetFlagStr(EndIPOff + 21)
Country = GetFlagStr(EndIPOff + 12)
End If
Else
LocalStr = GetFlagStr(EndIPOff + 8)
End If
Else
Country = GetFlagStr(EndIPOff + 4)
LocalStr = GetFlagStr(Stream.Position)
End If
' 過濾數(shù)據(jù)庫中的無用信息
Country = Trim(Country)
LocalStr = Trim(LocalStr)
If InStr(Country, "CZ88.NET") Then Country = ""
If InStr(LocalStr, "CZ88.NET") Then LocalStr = ""
End Sub
' ============================================
' 獲取IP地址標識符
' ============================================
Private Function GetFlagStr(OffSet)
Dim Flag
Flag = 0
Do While (True)
Stream.Position = OffSet
Flag = AscB(Stream.Read(1))
If(Flag = 1 Or Flag = 2 ) Then
Buf = Stream.Read(3)
If (Flag = 2 ) Then
CountryFlag = 2
EndIPOff = OffSet - 4
End If
OffSet = AscB(MidB(Buf, 1, 1)) + (AscB(MidB(Buf, 2, 1))*256) + (AscB(MidB(Buf, 3, 1))*256*256)
Else
Exit Do
End If
Loop
If (OffSet < 12 ) Then
GetFlagStr = ""
Else
Stream.Position = OffSet
GetFlagStr = GetStr()
End If
End Function
分享:ASP防止GET,Post注入和防止服務(wù)器攻擊,并記錄IP% '防止GET,Post注入和防止服務(wù)器攻擊 '使用方法把本文件包含到需要防注的文件就OK了,說明下,這里的post攻擊和Get攻擊不一定是攻擊,在英文版本的時候請注意使用 '馮旭修改 session.Abandon() Dim fxjt111_Attack_post,fxjt111_Attack_Get,fxjt111_Attack_Sys
相關(guān)ASP教程:
- 相關(guān)鏈接:
- 教程說明:
ASP教程-ASP調(diào)用純真IP庫實例(3)。