<%
Function IsValidEmail(email)
	Dim names, name, i, c
	IsValidEmail = True
	names = Split(email, "@")
	If UBound(names) <> 1 Then
	   IsValidEmail = False
	   Exit Function
	End If
	For Each name In names
	   If Len(name) <= 0 Then
		 IsValidEmail = False
		 Exit Function
	   End If
	   For i = 1 To Len(name)
		 c = Lcase(Mid(name, i, 1))
		 If InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric(c) Then
		   IsValidEmail = False
		   Exit Function
		 End If
	   Next
	   If Left(name, 1) = "." or Right(name, 1) = "." Then
		  IsValidEmail = False
		  Exit Function
	   End If
	Next
	If InStr(names(1), ".") <= 0 Then
	   IsValidEmail = False
	   Exit Function
	End If
	i = Len(names(1)) - InStrRev(names(1), ".")
	If i <> 2 and i <> 3 Then
	   IsValidEmail = False
	   Exit Function
	End If
	If InStr(email, "..") > 0 Then
	   IsValidEmail = False
	End If
End Function
Function ChkIsBadstr(ByVal str)
	str = Trim(str)
	ChkIsBadstr = False
	If Len(str) < 1 Then Exit Function

	Dim i, m_str, m_strAllow, m_strAllowable
	m_strAllowable = Chr(0) & Chr(34) & Chr(39) & Chr(9) & vbCrLf & "%@!?+|#^=-$;,*<>"
	
	For i = 1 To Len(m_strAllowable)
		m_str = Mid(m_strAllowable, i, 1)
		If InStr(str,m_str) > 0 Then
			ChkIsBadstr = False
			Exit Function
		End If
	Next
	ChkIsBadstr = True
End Function
'是否符合只是英文加数字的字串
Function ChkIsEnAndNum(str)
	ChkIsEnAndNum = False
	Dim Re
	Dim IsTrue
	Set re=new RegExp
	Re.IgnoreCase =True
	Re.Global=True
	Re.Pattern="^[a-z0-9]*$"
	IsTrue = Re.test(str)
	If IsTrue = False Then Exit Function
	Re.Pattern="[a-zA-Z]{1,}"
	IsTrue = Re.test(str)
	If IsTrue = False Then Exit Function
	Re.Pattern="[0-9]{1,}"
	IsTrue = Re.test(str)
	If IsTrue = False Then Exit Function
	ChkIsEnAndNum = IsTrue
	Set Re = Nothing
End Function
'是否符合电话规则（手机或电话）
Function ChkIsPhone(str)
	Dim Re
	Set re=new RegExp
	Re.IgnoreCase =True
	Re.Global=True
	Re.Pattern="(^(\d{3,4}-)?\d{7,10})$|([0-9]{9,13})"
	ChkIsPhone = Re.test(str)
	Set Re = Nothing
End Function
Function CheckeIsURL(str)
	Dim Re
	Set re=new RegExp
	Re.IgnoreCase =True
	Re.Global=True
	Re.Pattern="(^http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?)"
	CheckeIsURL = Re.test(str)
	Set Re = Nothing
End Function

%>
