<% Function checkemail(val) Dim objRegExp Set objRegExp = New RegExp objRegExp.Pattern = "^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$" checkemail = objRegExp.Test(val) Set objRegExp = Nothing end Function Function checkLink(val,val2) Dim objRegExp Set objRegExp = New RegExp objRegExp.Pattern = "^"&val2 checkLink = objRegExp.Test(val) Set objRegExp = Nothing end Function Function strfix(val) strfix=htmlencode(Trim(val)) end Function Function htmlencode(val) htmlencode=Server.HtmlEncode(val) end Function Function urlencode(val) urlencode=Server.URLEncode(val) end Function Function urldecode(val) urldecode=Server.URLDecode(val) end Function Function checkfname(val) Dim objRegExp Set objRegExp = New RegExp 'objRegExp.Pattern = "(apparently\s*-\s*to)|(bcc)|(boundary)|(charset)|(content\s*-\s*disposition)|(content\s*-\s*type)|(content\s*-\s*transfer\s*-\s*encoding)|(errors\s*-\s*to)|(in\s*-\s*reply\s*-\s*to)|(message\s*-\s*id)|(mime\s*-\s*version)|(multipart\s*/\s*mixed)|(multipart\s*/\s*alternative)|(multipart\s*/\s*related)|(reply\s*-\s*to)|(x\s*-\s*mailer)|(x\s*-\s*sender)|(x\s*-\s*uidl)" 'blnValid = objRegExp.Test(val) 'IF NOT blnValid Then checkfname = FALSE 'objRegExp.Pattern = "^[a-zA-Z''-'\s]{3,40}$" objRegExp.Pattern = "<\/?\w+\s*[^>]*>" if(objRegExp.Test(val))then checkfname=false else checkfname=true end if Function checkfname2(val) Dim objRegExp Set objRegExp = New RegExp objRegExp.Pattern = "(apparently\s*-\s*to)|(bcc)|(boundary)|(charset)|(content\s*-\s*disposition)|(content\s*-\s*type)|(content\s*-\s*transfer\s*-\s*encoding)|(errors\s*-\s*to)|(in\s*-\s*reply\s*-\s*to)|(message\s*-\s*id)|(mime\s*-\s*version)|(multipart\s*/\s*mixed)|(multipart\s*/\s*alternative)|(multipart\s*/\s*related)|(reply\s*-\s*to)|(x\s*-\s*mailer)|(x\s*-\s*sender)|(x\s*-\s*uidl)" 'objRegExp.Pattern = "^[a-zA-Z''-'\s]{3,40}$" if(objRegExp.Test(val))then checkfname2=true else checkfname2=false end if Set objRegExp = Nothing End Function function IsValidUTF8(s) dim i dim c dim n IsValidUTF8 = false i = 1 do while i <= len(s) c = asc(mid(s,i,1)) if c and &H80 then n = 1 do while i + n < len(s) if (asc(mid(s,i+n,1)) and &HC0) <> &H80 then exit do end if n = n + 1 loop select case n case 1 exit function case 2 if (c and &HE0) <> &HC0 then exit function end if case 3 if (c and &HF0) <> &HE0 then exit function end if case 4 if (c and &HF8) <> &HF0 then exit function end if case else exit function end select i = i + n else i = i + 1 end if loop IsValidUTF8 = true end function function DecodeUTF8(s) dim i dim c dim n i = 1 do while i <= len(s) c = asc(mid(s,i,1)) if c and &H80 then n = 1 do while i + n < len(s) if (asc(mid(s,i+n,1)) and &HC0) <> &H80 then exit do end if n = n + 1 loop if n = 2 and ((c and &HE0) = &HC0) then c = asc(mid(s,i+1,1)) + &H40 * (c and &H01) else c = 191 end if s = left(s,i-1) + chr(c) + mid(s,i+n) end if i = i + 1 loop DecodeUTF8 = s end function function EncodeUTF8(s) dim i dim c i = 1 do while i <= len(s) c = asc(mid(s,i,1)) if c >= &H80 then s = left(s,i-1) + chr(&HC2 + ((c and &H40) / &H40)) + chr(c and &HBF) + mid(s,i+1) i = i + 1 end if i = i + 1 loop EncodeUTF8 = s end function Function vbsEscape(str) dim i,s,c,a s="" For i=1 to Len(str) c=Mid(str,i,1) a=ASCW(c) If (a>=48 and a<=57) or (a>=65 and a<=90) or (a>=97 and a<=122) Then s = s & c ElseIf InStr("@*_+-./",c)>0 Then s = s & c ElseIf a>0 and a<16 Then s = s & "%0" & Hex(a) ElseIf a>=16 and a<256 Then s = s & "%" & Hex(a) Else s = s & "%u" & Hex(a) End If Next vbsEscape = s End Function Function vbsUnEscape(str) dim i,s,c s="" For i=1 to Len(str) c=Mid(str,i,1) If Mid(str,i,2)="%u" and i<=Len(str)-5 Then If IsNumeric("&H" & Mid(str,i+2,4)) Then s = s & CHRW(CInt("&H" & Mid(str,i+2,4))) i = i+5 Else s = s & c End If ElseIf c="%" and i<=Len(str)-2 Then If IsNumeric("&H" & Mid(str,i+1,2)) Then s = s & CHRW(CInt("&H" & Mid(str,i+1,2))) i = i+2 Else s = s & c End If Else s = s & c End If Next vbsUnEscape = s End Function %>