域名查询系统用到的类
程序员文章站
2022-04-14 20:44:10
复制代码 代码如下:<% dim domain set domain = new cls_domainfunctio...
复制代码 代码如下:
<%
dim domain
set domain = new cls_domainfunction
class cls_domainfunction
private vlisturl
private thief_
private vdomainarr, vdomainname
private vloopi
private vdomainsname, vdomainmainbody
private tldcode
private rs, sql
private extradataarr
private whoisarr, whoiscreationdate, whoisexpirationdate, whoisorg, whoisname, whoisbaidusite, whoisbaidubody, whoispagerank
public sqlquerylengthid, sqlquerycomposetypeid, sqlquerytldid, sqlorderbyid
private sqlquerylength, sqlquerycomposetype, sqlquerytld, sqlorderby
public function getdomainlist(vlistid)
select case vlistid
case 1 : vlisturl = "http://www.cnnic.net.cn/download/registar_list/pendingdel.txt"
case 2 : vlisturl = "http://www.cnnic.net.cn/download/registar_list/future2todaydel.txt"
case 3 : vlisturl = "http://www.cnnic.net.cn/download/registar_list/future1todaydel.txt"
case 4 : vlisturl = "http://www.cnnic.net.cn/download/registar_list/1todaydel.txt"
case 5 : vlisturl = "http://www.cnnic.net.cn/download/registar_list/2todaydel.txt"
case 6 : vlisturl = "http://www.cnnic.net.cn/download/registar_list/3todaydel.txt"
case else : vlisturl = "http://www.cnnic.net.cn/download/registar_list/future1todaydel.txt"
end select
set thief_ = new cls_thief
thief_.source = vlisturl
thief_.steal
vdomainarr = split(thief_.value, vblf)
set thief_ = nothing
if ubound(vdomainarr) < 2 then call cmd.outputjavainfo("cnnic最新数据库尚未发布。")
call conndb()
for vloopi = 0 to ubound(vdomainarr)
vdomainsname = lcase(vdomainarr(vloopi))
if instr(vdomainsname, ".") > 0 then
vdomainmainbody = split(vdomainsname, ".")(0)
conn.execute("insert into [cndomainlist](domainname, body, length, composetype, tld) values('" & vdomainsname & "', '" & vdomainmainbody & "', " & len(vdomainmainbody) & ", " & getdomaincomposetype(vdomainmainbody) & ", " & getdomainltd(vdomainsname) & ")")
end if
next
call disconndb()
call compactdatabase(vdatabasepath, false)
end function
public function clearupdatabase()
call conndb()
conn.execute("delete * from [cndomainlist]")
call disconndb()
call compactdatabase(vdatabasepath, false)
end function
private function getdomaincomposetype(domainname)
if cmd.isalpha(domainname) then
getdomaincomposetype=1
elseif cmd.isdigit(domainname) then
getdomaincomposetype=2
elseif cmd.isalphadigit(domainname) then
getdomaincomposetype=3
else
getdomaincomposetype=4
end if
end function
private function getdomainltd(domainname)
if ubound(split(domainname, ".")) > 1 then
select case split(domainname, ".")(1)
case "com"
tldcode = 10011
case "net"
tldcode = 10021
case "org"
tldcode = 10051
case "gov"
tldcode = 10061
case "ac"
tldcode = 10071
case else
tldcode = 10041
end select
else
tldcode = 10001
end if
getdomainltd = tldcode
end function
private sub compactdatabase(databasepath, boolis97)
on error resume next
dim fso, engine, strdatabasepath,jet_3x
strdatabasepath = left(databasepath,instrrev(databasepath,"\"))
set fso = createobject("scripting.filesystemobject")
if err.number <> 0 then
err.clear()
exit sub
end if
if fso.fileexists(databasepath) then
fso.copyfile databasepath,strdatabasepath & "compactdbtemp.mdb"
set engine = createobject("jro.jetengine")
if boolis97 = "true" then
engine.compactdatabase "provider=microsoft.jet.oledb.4.0;data source=" & strdatabasepath & "compactdbtemp.mdb", _
"provider=microsoft.jet.oledb.4.0;data source=" & strdatabasepath & "compactdbtemp1.mdb;" _
& "jet oledb:engine type=" & jet_3x
else
engine.compactdatabase "provider=microsoft.jet.oledb.4.0;data source=" & strdatabasepath & "compactdbtemp.mdb", _
"provider=microsoft.jet.oledb.4.0;data source=" & strdatabasepath & "compactdbtemp1.mdb"
end if
fso.copyfile strdatabasepath & "compactdbtemp1.mdb",databasepath
fso.deletefile(strdatabasepath & "compactdbtemp.mdb")
fso.deletefile(strdatabasepath & "compactdbtemp1.mdb")
set fso = nothing
set engine = nothing
if err.number <> 0 then
err.clear()
exit sub
end if
end if
end sub
end class
%>
上一篇: 生活冷知识
下一篇: wpf dual monitor