Hej *phew* Domain checker script
Jag har ett aspscript som man kanse om ett domännamn är ledigt eller upptaget men man kunde inte söka svenska namn vilket jag la till, problemet är att det hela tiden säger att namnet är ledigt även man man söker på "klnlvnkjkf.se" så jag vet inte mot vilken adress sökningen ska ha. Samma sak gäller det att jag skulle vilja att man kan söka med åäö men är också där osäker på vad som ska ändras, har testat en del utan framgång, det finns bar en sida med kod och det är denna, tacksam om någon kan hjälpa mig.
<% Option Explicit %>
<%
'Set the response buffer to true
Response.Buffer = False
'Set the script timeout to 90 seconds
Server.ScriptTimeout = 90
'Whois function to query the whois server
Private Function whoisResult(whoisURL, strMethod, strCheckString)
'Dimension variables
Dim objXMLHTTP 'Holds the XML HTTP Object
Dim strWhoisResultString 'Holds the reult of the whois query
'Create an XML object to query the remote whois server
Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
'Alternative XML HTTP component, for version 3.0 of XMLHTTP
'Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
'Open a connection to the remote whois server
objXMLHTTP.Open strMethod, whoisURL, False
'Send the request and return the data
objXMLHTTP.Send
'Place the whois registry response into the result string
strWhoisResultString = objXMLHTTP.ResponseText
'If the domain name is to short then tell them it's invalid
If Len(strDomainName) < 3 Then
'Set the return result of the function to not valid
whoisResult = "Inte Gilltigt - det måste vara minst 3 tecken"
'Check the whois result to see if a result has NOT been found
ElseIf InStr(1, strWhoisResultString, strCheckString, vbTextCompare) Then
'Set the return result of the function to available
whoisResult = "Namnet du sökte på är Ledigt"
'Else if there is an error
ElseIF InStr(1, strWhoisResultString, "Error", vbTextCompare) Then
'Set the return result of the function to Taken
whoisResult = "Ett problem har uppstått"
'Else there was a result
Else
'Set the return result of the function to Taken
whoisResult = "Namnet du sökte på är Upptaget"
End If
'Clean up
Set objXMLHTTP = Nothing
End Function
'Function to strip non alphanumeric characters
Private Function characterStrip(strTextInput)
'Dimension variable
Dim intLoopCounter 'Holds the loop counter
'Loop through the ASCII characters up to - hyphen
For intLoopCounter = 0 to 44
strTextInput = Replace(strTextInput, CHR(intLoopCounter), "", 1, -1, 0)
Next
'Loop through the ASCII characters from hyphen to numeric charcaters
For intLoopCounter = 46 to 47
strTextInput = Replace(strTextInput, CHR(intLoopCounter), "", 1, -1, 0)
Next
'Loop through the ASCII characters numeric characters to lower-case characters
For intLoopCounter = 58 to 96
strTextInput = Replace(strTextInput, CHR(intLoopCounter), "", 1, -1, 0)
Next
'Loop through the extended ASCII characters
For intLoopCounter = 123 to 255
strTextInput = Replace(strTextInput, CHR(intLoopCounter), "", 1, -1, 0)
Next
'Return the string
characterStrip = strTextInput
End Function
'Dimension variables
Dim strDomainName 'Holds the domain name to search for
Dim strSuffix 'Holds the domain name suffix to search
'Read in the domain name to search
strDomainName = Trim(Request.QueryString("domain"))
strSuffix = Trim(Request.QueryString("suffix"))
'If a domain name has been entred then strip any unwanted characters from it
If strDomainName <> "" Then
'Convert the domain name to check to lower case
strDomainName = LCase(strDomainName)
'Remove www and http from in front
strDomainName = Replace(strDomainName, "http://", "", 1, -1, 1)
strDomainName = Replace(strDomainName, "www.", "", 1, -1, 1)
'Remove suffixes
strDomainName = Replace(strDomainName, ".com", "", 1, -1, 1)
strDomainName = Replace(strDomainName, ".net", "", 1, -1, 1)
strDomainName = Replace(strDomainName, ".org", "", 1, -1, 1)
strDomainName = Replace(strDomainName, ".info", "", 1, -1, 1)
strDomainName = Replace(strDomainName, ".biz", "", 1, -1, 1)
strDomainName = Replace(strDomainName, ".tv", "", 1, -1, 1)
strDomainName = Replace(strDomainName, ".name", "", 1, -1, 1)
strDomainName = Replace(strDomainName, ".co.uk", "", 1, -1, 1)
strDomainName = Replace(strDomainName, ".org.uk", "", 1, -1, 1)
strDomainName = Replace(strDomainName, ".ltd.uk", "", 1, -1, 1)
strDomainName = Replace(strDomainName, ".plc.uk", "", 1, -1, 1)
strDomainName = Replace(strDomainName, ".net.uk", "", 1, -1, 1)
strDomainName = Replace(strDomainName, ".me.uk", "", 1, -1, 1)
strDomainName = Replace(strDomainName, ".pn.uk", "", 1, -1, 1)
strDomainName = Replace(strDomainName, ".se", "", 1, -1, 1)
'Remove any hyphens from the first and last characters
If Left(strDomainName, 1) = "-" Then strDomainName = Mid(strDomainName, 2, Len(strDomainName))
If Right(strDomainName, 1) = "-" Then strDomainName = Mid(strDomainName, 1, Len(strDomainName)-1)
'Remove any hyphens double hyphens
strDomainName = Replace(strDomainName, "--", "-", 1, -1, 1)
'Strip all non aphanumeric characters from the input
strDomainName = characterStrip(strDomainName)
End If
%>
<html>
<head>
<title>Domain Name Checker</title>
<!-- The Web Wiz Guide ASP Domain Checker is written and produced by Bruce Corkhill ©2002
If you want your own ASP Domain Checker then goto http://www.webwizguide.info -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body bgcolor="#66CCCC" text="#000000" link="#0000CC" vlink="#0000CC" alink="#FF0000">
<center>
<font size="5"><b><font size="4" face="Arial, Helvetica, sans-serif"> Domain Name Checker</font></b></font><br>
Domain Name Checker kollar om ett domän-namn är ledigt, söker
i <br>
.com, .net, .biz, info, .org, .co.uk, org.uk, net.uk, plc.uk, ltd.uk, .us, .se
</center>
<form strMethod="get" name="frmDomainCheck" action="domain_checker.asp">
<table cellpadding="0" cellspacing="0" width="393" align="center">
<tr>
<td height="66" width="65" align="right" rowspan="3" valign="middle"><img src="domain_search.gif" width="43" height="42" align="absmiddle" alt="Domännamn Sökning">
</td>
<td height="66" width="31" align="left" rowspan="3" valign="middle"> </td>
<td class="arial" height="4" width="295"> Skriv i vad ditt domän-namn
skulle heta: </td>
</tr>
<tr>
<td class="normal" height="2" width="295">
<input type="TEXT" name="domain" maxlength="35" size="20" value="<% = strDomainName %>">
<select name="suffix">
<option<% If Request.QueryString("suffix") = "" OR Request.QueryString("suffix") = ".co.uk" Then Response.Write(" selected")%>>.co.uk</option>
<option<% If Request.QueryString("suffix") = ".me.uk" Then Response.Write(" selected")%>>.me.uk</option>
<option<% If Request.QueryString("suffix") = ".org.uk" Then Response.Write(" selected")%>>.org.uk</option>
<option<% If Request.QueryString("suffix") = ".net.uk" Then Response.Write(" selected")%>>.net.uk</option>
<option<% If Request.QueryString("suffix") = ".plc.uk" Then Response.Write(" selected")%>>.plc.uk</option>
<option<% If Request.QueryString("suffix") = ".ltd.uk" Then Response.Write(" selected")%>>.ltd.uk</option>
<option<% If Request.QueryString("suffix") = ".us" Then Response.Write(" selected")%>>.us</option>
<option<% If Request.QueryString("suffix") = ".com" Then Response.Write(" selected")%>>.com</option>
<option<% If Request.QueryString("suffix") = ".net" Then Response.Write(" selected")%>>.net</option>
<option<% If Request.QueryString("suffix") = ".org" Then Response.Write(" selected")%>>.org</option>
<option<% If Request.QueryString("suffix") = ".biz" Then Response.Write(" selected")%>>.biz</option>
<option<% If Request.QueryString("suffix") = ".info" Then Response.Write(" selected")%>>.info</option>
<option<% If Request.QueryString("suffix") = ".se" Then Response.Write(" selected")%>>.se</option>
</select>
<input name="submit" type="submit" value="Search >>">
</td>
</tr>
<tr>
<td class="normal" height="19" width="295" valign="top"> </td>
</tr>
</table>
</form>
<center>
<table width="70%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="top">
<%
'If a domain name is enterd check it
If strDomainName <> "" Then
'Display the avialbility
Response.Write("<b>www." & strDomainName & strSuffix & " är<br><font color=""color: #FF0000;"">")
'Call the domain checking function depending on domain suffix
'Check for .co.uk
If strSuffix = ".co.uk" Then
Response.Write(whoisResult("http://195.66.240.196/cgi-bin/whois.cgi?query=" & strDomainName & ".co.uk", "GET", "No match"))
'Check for .me.uk
ElseIf strSuffix = ".me.uk" Then
Response.Write(whoisResult("http://195.66.240.196/cgi-bin/whois.cgi?query=" & strDomainName & ".me.uk", "GET", "No match"))
'Check for .org.uk
ElseIf strSuffix = ".org.uk" Then
Response.Write(whoisResult("http://195.66.240.196/cgi-bin/whois.cgi?query=" & strDomainName & ".org.uk", "GET", "No match"))
'Check for .net.uk
ElseIf strSuffix = ".net.uk" Then
Response.Write(whoisResult("http://195.66.240.196/cgi-bin/whois.cgi?query=" & strDomainName & ".net.uk", "GET", "No match"))
'Check for .ltd.uk
ElseIf strSuffix = ".ltd.uk" Then
Response.Write(whoisResult("http://195.66.240.196/cgi-bin/whois.cgi?query=" & strDomainName & ".ltd.uk", "GET", "No match"))
'Check for .plc.uk
ElseIf strSuffix = ".plc.uk" Then
Response.Write(whoisResult("http://195.66.240.196/cgi-bin/whois.cgi?query=" & strDomainName & ".plc.uk", "GET", "No match"))
'Check for .us
ElseIf strSuffix = ".us" Then
Response.Write(whoisResult("http://www.whois.us/whois.cgi?TLD=us&WHOIS_QUERY=" & strDomainName & "&TYPE=DOMAIN", "GET", "no records"))
'Check for .com
ElseIf strSuffix = ".com" Then
Response.Write(whoisResult("http://www.internic.net/cgi/whois?whois_nic=" & strDomainName & ".com&type=domain", "GET", "No match"))
'check for .net
ElseIf strSuffix = ".net" Then
Response.Write(whoisResult("http://www.internic.net/cgi/whois?whois_nic=" & strDomainName & ".net&type=domain", "GET", "No match"))
'Check for .org
ElseIf strSuffix = ".org" Then
Response.Write(whoisResult("http://www.internic.net/cgi/whois?whois_nic=" & strDomainName & ".org&type=domain", "GET", "No match"))
'Check for .biz
ElseIf strSuffix = ".biz" Then
Response.Write(whoisResult("http://www.internic.net/cgi/whois?whois_nic=" & strDomainName & ".biz&type=domain", "GET", "Not found"))
'Check for .info
ElseIf strSuffix = ".info" Then
Response.Write(whoisResult("http://www.internic.net/cgi/whois?whois_nic=" & strDomainName & ".info&type=domain", "GET", "NOT FOUND"))
'Check for .se
ElseIf strSuffix = ".se" Then
Response.Write(whoisResult("http://www.whois.nic-se.se=" & strDomainName & ".se&type=domain", "GET", "NOT FOUND"))
End If
'Finsh the red span tag
Response.Write("</font></b>")
End If
%>
</td>
</tr>
</table>
<br>
</center>
<br>
</body>
</html>Sv: Domain checker script
Blev lite chockad av att se den enormt stora koden för en domain checker.
Denna kod:<code>
<%
If request.form("domain")<>"" then
' Intruduce the url you want to visit
GotothisURL = "http://www." & request.form("domain")
' Create the xml object
Set GetConnection = CreateObject("Microsoft.XMLHTTP")
' Conect to specified URL
GetConnection.Open "get", GotothisURL, False
on error resume next
GetConnection.Send
' ResponsePage is the response, then print it out to the page
ResponsePage = GetConnection.getResponseHeader("Date")
' Write response
if ResponsePage="" then
Response.write("This domain name may be available")
else
Response.write("This domain name is taken")
end if
Set GetConnection = Nothing
else
%>
<form method=post action=<% =request.servervariables("URL") %>>
<input type=text name=domain size=15 value="domain.com">
<input type=submit value="Find domain name">
</form>
<% end if %>
</code>
Visserligen mycket enkel och ger inget 100% säkert svar på om domänen är ledig eller inte. Hjälper dock inte dig med ditt problem!
Möjlighet att testa det på: http://www.mkd.nu/domain_checker.asp