Core code:
Verify that the input URL is valid and can access <% '********************************* 'Function: UrlOK(strURL) 'Parameters: strURL, URL to be verified' Date: 2007/7/13 'Description: Verify that the input URL is valid and can access' Example: <%=UrlOK("//www.Vevb.com")%> '********************************* Function UrlOK(strURL) On Error Resume Next If strURL<>"" Then Set objHTTP = CreateObject("MSXML2.XMLHTTP") objHTTP.Open "GET", strURL, FALSE objHTTP.Send If instr(objHTTP.statusText,"OK") Then UrlOK = "Valid" Else UrlOK = "Invalid" End if Else UrlOK = "Error: You did not enter the URL!" End If End Function %> Regularly verify whether the input URL is legal. URL<% '*************************************** 'Function: checkexp(patrn,strng) 'Parameters: patrn regular expression; strng Verification string'Author: Alixixi'Date: 2007/7/13'Description: URL that regex is legitimate'Example: <%=checkexp(patrn,strng)%> '********************************* function checkexp(patrn,strng) dim regex,match set regex = new regexp ' Create regular expression. regex.pattern = patrn ' Set mode. regex.ignorecase = true ' Set whether characters are case sensitive. regex.global = true ' Set global availability. matches = regex.test(strng) checkexp = matches end function %>