原作者:Loster
'函数名:chk_Email()
'返回值:布尔值(True为通过,False为未通过)
'参数:email(需要判断的email,类型:字符串) Type_1(是否需要判断@之后的domain,类型:布尔值)
'Type_2(是否只能是特定域的E-Mail注册,类型:布尔值) Type_3(一个E-Mail是否只能注册一次,类型:布尔值)
Const C_maildomain=".com,.com.cn,.net,.net.cn,.org,.org.cn,.gov,.gov.cn,.edu,.edu.cn,.cn,.cc,.biz,.info" '电子邮件可接受的domain
Const C_Lockdomain="bit.edu.cn,loster.org" '特定的域
Function chk_Email(email,Type_1,Type_2,Type_3)
Dim i,k
Dim At
Dim Email_1,Temp
If email="" Then
chk_Email=False
Exit Function
End If
Email_1=Cstr(trim(email))
If Len(Email_1)<5 Then
chk_Email=False
Exit Function
End If
At=False
For i=1 To Len(Email_1)
Temp=Mid(Email_1,i,1)
If Temp="@" Then
at=True
Exit For
End If
Next
If At=False Then
Chk_Email=False
Exit Function
End If
k=0
For i=1 To Len(Email_1)
Temp=Mid(Email_1,i,1)
If Temp="." then
k=k+1
End If
Next
If k=0 Or k>2 Then
Chk_Email=False
Exit Function
End If
If Type_1=True Then
For i=1 To Len(Email_1)
Temp=Mid(Email_1,i,1)
If Temp="@" Then
k=i
Exit For
End If
Next
For i=k To Len(Email_1)
Temp=Mid(Email_1,i,1)
If Temp="." Then
k=i
Exit For
End If
Next
Temp=""
For i=k To Len(Email_1)
Temp=Temp+Mid(Email_1,i,1)
Next
Temp=Cstr(Trim(Temp))
At=False
For i=0 To R_Reader(C_Maildomain,",")
If Temp=Reader(i) Then
At=True
Exit For
End If
Next
Erase Reader
If At=False Then
Chk_Email=False