<%
'========================================================
'IP情報を返すDisp_ipaddressData(IP、0)
'========================================================
functionlook_ip(ip)
薄暗い...
'クラスオブジェクトの設定
Set Station = new tqqwry
'検索を開始して、検索結果を返します
'QQWry(IP)戻り値に基づいてデータベースにIPアドレスが存在するかどうかを判断でき、存在がない場合は他の操作を実行できます
「たとえば、あなたは狩りとしてデータベースを構築しました、私はここで詳細に説明しません
iptype = wry.qqwry(ip)
'国:国家および地域の分野
'LocalStr:地方および自治体およびその他の情報分野
look_ip = wry.country&&wry.localstr
'' look_ip = wry.country&
エンド関数
'========================================================
'IP情報JSコールに戻ります
'========================================================
関数disp_ipaddressdata(ip、style)
ディモーバー、iltype
Set Station = new tqqwry
iptype = wry.qqwry(ip)
ケーススタイルを選択します
ケース1 DISP_IPADDRESSDATA = IP
ケース2 Disp_ipaddressdata = station.country
ケース3 disp_ipaddressdata = wry.localstr
'ケース他のDisp_ipaddressdata = wry.country&&wry.localstr
ケースelse disp_ipaddressdata = wry.country
[選択]を終了します
エンド関数
'========================================================
'qwry情報に戻ります
'========================================================
関数wryinfo()
DIMOVER、iPtype、qqwry_tem(0)、qqwry_tem1(1)
'クラスオブジェクトの設定
Set Station = new tqqwry
iptype = wry.qqwry(255.255.255.254)
'データベースバージョン情報をお読みください
qqwry_tem(0)= wry.country&&wry.localstr
'データベースIPアドレスの数をお読みください
qqwry_tem1(1)= wry.recordcount + 1
wryinfo = qqwry_tem(0)&qqwry_tem1(1)
エンド関数
クラスtqqwry
'========================================================
'可変評判
'========================================================
Dim Country、LocalStr、BUF、オフセット
プライベートstartIP、Endip、CountryFlag
public qqwryfile
Public FirstStartip、LastStartip、RecordCount
プライベートストリーム、エンディポフ
'========================================================
'クラスモジュールの初期化
'========================================================
private sub class_initialize
国=
localStr =
startip = 0
endip = 0
CountryFlag = 0
FirstStartip = 0
lastStartip = 0
endipoff = 0
qqwryfile = server.mappath(/data/qqwry.dat) 'qq Innocent IP inventoryパス、パスに変更する
End Sub
'========================================================
'IPアドレスは整数に変換されます
'========================================================
関数iptoint(ip)
Dim Iparray、i
iParray = split(ip、。、-1)
i = 0〜3の場合
is -numeric(iparray(i))にない場合はiparray(i)= 0
if cint(iparray(i))<0 thatn iparray(i)= abs(cint(iparray(i)))
cint(iparray(i))> 255の場合、iparray(i)= 255
次
iptoint =(cint(iparray(0))*256*256*256) +((cint(iparray(1))*256*256) +(cint(iparray(2))*256) + cint(iparray(3)治す
エンド関数
'========================================================
'IPアドレスを逆転させる整数
'========================================================
function inttoip(intvalue)
p4 = int value -fix(intvalue/256)*256
intvalue =(intvalue-p4)/256
p3 = int value -fix(intvalue/256)*256
intvalue =(intvalue-p3)/256
p2 = int value -fix(intvalue/256)*256
intvalue =(intvalue -p2)/256
P1 = int値
Into = CSTR(P1)&CSTR(P2)&。
エンド関数
'========================================================
'開始IPの場所を取得します
'========================================================
プライベート機能GetStartip(RECNO)
offset = firstStartip + recno * 7
stream.position = offset
buf = stream.read(7)
endipoff = ascb(midb(buf、5、1)) +(ascb(midb(buf、6、1))*256) +(ascb(midb(buf、7、1))*256*256)
startip = 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)
getStartIP = startIP
エンド関数
'========================================================
'終了IP位置を取得します
'========================================================
プライベート機能geetedip()
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
エンド関数
'========================================================
'国や州や都市を含む地域情報を入手する
'========================================================
プライベートサブゲットカントリー(IP)
if(countryflag = 1またはcountryflag = 2)then
国= getflagstr(endipoff + 4)
countryflag = 1の場合
localStr = getflagstr(stream.position)
'以下は、データベースバージョン情報を取得するために使用されます
ip> = iptoint(255.255.255.0)およびip <= iptoint(255.255.255.255)の場合、
localStr = getflagstr(endipoff + 21)
国= getflagstr(endipoff + 12)
ifを終了します
それ以外
localStr = getflagstr(endipoff + 8)
ifを終了します
それ以外
国= getflagstr(endipoff + 4)
localStr = getflagstr(stream.position)
ifを終了します
'データベースで役に立たない情報をフィルタリングします
国=トリム(国)
localStr = trim(localsstr)
If strust(country、cz88.net)からcountry =
If strust(localstr、cz88.net)の場合、localsstr =
End Sub
'========================================================
'IPアドレス識別子を取得します
'========================================================
プライベート機能getflagstr(オフセット)
薄暗いフラグ
フラグ= 0
全体(真)を実行する
stream.position = offset
flag = ascb(stream.read(1))
if(flag = 1またはflag = 2)
buf = stream.read(3)
if(flag = 2)then
CountryFlag = 2
endipoff = offset -4
ifを終了します
offset = ascb(midb(buf、1、1)) +(ascb(midb(buf、2、1))*256) +(ascb(midb(buf、3、1))*256*256)
それ以外
終了します
ifを終了します
ループ
if(offset <12)then
getflagstr =
それ以外
stream.position = offset
getFlagstr = getStr()
ifを終了します
エンド関数
'========================================================
'文字列情報を取得します
'========================================================
プライベート関数getStr()
薄暗いc
getStr =
全体(真)を実行する
c = ascb(stream.read(1))
if(c = 0)から終了します
'それが2バイトの場合、高いバイトがキャラクターの低バイト合成と組み合わせて組み合わされています
c> 127の場合
stream.eosの場合、出口は行います
getStr = getStr&chr(ascw(chrb(ascb(stream.read(1)))&chrb(c))
それ以外
getStr = getStr&chr(c)
ifを終了します
ループ
エンド関数
'========================================================
'コア関数、IP検索を実行します
'========================================================
パブリック関数qqwry(dotip)
薄暗いIP、nret
Dim Rangb、範囲、範囲、範囲
ip = iptoint(dotip)
SET stream = createObject(adodb.stream)
stream.mode = 3
stream.type = 1
stream.open
stream.loadfromfile qqwryfile
stream.position = 0
buf = stream.read(8)
firstStartip = 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)
lastStartip = ascb(midb(buf、5、1)) +(ascb(midb(buf、6、1))*256) +(ascb(midb(buf、7、1))*256*256) +(ascb (MIDB(BUF、8、1))*256*256*256)
RecordCount = int
'データベースにIPアドレスが見つかりません
if(recordcount <= 1)then
国=不明
qqwry = 2
出口機能
ifを終了します
rangb = 0
範囲= RecordCount
理由を行う(rangb <(範囲-1))
rangb + range/2)
getStartip(RECNO)を呼び出す
if(ip = startip)then
rangb = recino
終了します
ifを終了します
if(ip> startip)then
rangb = recino
それ以外
範囲= recno
ifを終了します
ループ
getStartip(rangb)を呼び出す
getEndip()に電話してください
if(startip <= ip)および(endip> = ip)then
'見つかりません
nret = 0
それ以外
' 普通
nret = 3
ifを終了します
getCountry(IP)に電話する
qqwry = nret
エンド関数
'========================================================
'クラスエンド
'========================================================
プライベートSub Class_terminate
エラーの再開時に次に再開します
stream.close
errの場合、err.clear
Set Stream = Nothing
End Sub
エンドクラス
%>