Avatar billede hartnet.dk Nybegynder
14. august 2005 - 19:03 Der er 1 kommentar og
1 løsning

Tilpas whois-script, så jeg kan tjekke alle TLD

<%
typex=trim(lcase(request.Querystring("type")))
strDomain = lcase(trim(Request.Querystring("domain")) & "." & typex)
formdom=request.Querystring("domain")

x_domain=strdomain

x=0
alc="1234567890-abcdefghijklmnopqrstuvwxyzæøå"

sdom= lcase(trim(Request.Querystring("domain")))

for n=1 to len(sdom)-1
    xc=mid(lcase(x_domain),n,1)
    cv=1
   
            for r=1 to len(alc)
                if xc=mid(alc,r,1) then cv=2
                if xc="-" then cv=2
                if asc(xc)=37 then cv=2
                if asc(xc)=45 then cv=2
            next
   
    if cv=1 then
        response.redirect "domain.asp"
    end if
next

If Len(strDomain) > 0 Then
   
    niclist="am,no,au,bt,bg,cl,cc,cg,bi,rw,zr,cr,cz,ec,fo,gl,fr,de,ir,it,jo,my,mx,ni,fi,nl,nu,pk,pl,ru,sg,sk,es,tw,th,to,tm,uk,ua,co,ch,li"
    for n=1 to len(niclist) step 3
        xnic=mid(niclist,n,2)
        if xnic=typex then
        xhost="whois.ripe.net:43"
        end if
    next
   
    uslist="com,net"
    for n=1 to len(uslist) step 3
        xnic=mid(uslist,n,3)
        if xnic=typex then
        xhost="whois.ripe.net:43"
        end if
    next
   
        infolist="info"
    for n=1 to len(infolist) step 3
        xnic=mid(infolist,n,3)
        if xnic=typex then
        xhost="whois.afilias.net:43"
        end if
    next
   
    bizlist="biz"
    for n=1 to len(bizlist) step 3
        xnic=mid(bizlist,n,3)
        if xnic=typex then
        xhost="whois.biz:43"
        end if
    next
   
    orglist="org"
    for n=1 to len(orglist) step 3
        xnic=mid(orglist,n,3)
        if xnic=typex then
        xhost="whois.pir.org:43"
        end if
    next

    'netlist="net"
    'for n=1 to len(netlist) step 3
    '    xnic=mid(netlist,n,3)
    '    if xnic=typex then
    '    xhost="whois.verisign-grs.com:43"
    '    end if
    'next

    ripelist="il,gr,gg,je,biz"
    for n=1 to len(ripelist) step 3
        xnic=mid(ripelist,n,2)
        if xnic=typex then
        xhost="whois.ripe.net:43"
        end if
    next
   
    ripelist="as"
    for n=1 to len(ripelist) step 3
        xnic=mid(ripelist,n,2)
        if xnic=typex then
        xhost="whois.nic.as:43"
        end if
   
    next
   
    ripelist="se"
    for n=1 to len(ripelist) step 3
        xnic=mid(ripelist,n,2)
        if xnic=typex then
        xhost="whois.nic-se.se:43"
        end if
   
    next
       
        if typex="dk" then
        xhost="whois.dk-hostmaster.dk:43"
   
    end if
   
    if typex="jp" then
            xhost="whois.nic.ad.jp:43"
            strdomain=strdomain & "/e"
    end if
    if xhost<>"" then
            if ydk="" then
                        Set objSocket = Server.CreateObject("Socket.TCP")
                        objSocket.Host = xhost
                        objSocket.Open
                        objSocket.SendLine(strDomain) & vbCrLf
                        objSocket.WaitForDisconnect
                        tmpBuffer = objSocket.Buffer
            end if
                        optaget=0
                                for n=1 to len(tmpbuffer)
                            if lcase(mid(tmpbuffer,n,len(x_domain))) = lcase(x_domain) then
                                optaget=2
                                exit for
                          else
                              optaget=1
                            end if
                        next
                        if len(formdom)<2 then optaget=2
           
    if optaget<>2 then
        response.write "Domænet <u><b>www." & x_domain & "</u></b> er ledigt - <a href='bestilhotel.asp?type=oprettelse&dom=" & x_domain & "'>bestil</a>"
    end if
    if    optaget=2 then
                response.write "Domænet er optaget - <a href='bestilhotel.asp?type=redeleger&dom=" & x_domain & "'>Redeleger</a>"
        end if
               
                if optaget=2 then
                response.write  "<pre>" & tmpBuffer & "</pre>"
                end if
                if ydk="" then objSocket.Close
        end if
            else
End If
%>
Avatar billede hartnet.dk Nybegynder
14. august 2005 - 19:05 #1
Det er et rigtig godt script, kan bare ikke få det til at tjekke alle TLD.
Der må evt gerne laves så det tjekker alle automatisk, lidt a la Wannfinds.
Eller så den kan tjekke de TLD man har liggende i en DB.
Avatar billede hartnet.dk Nybegynder
16. januar 2006 - 13:16 #2
Lukker
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester