Denne funktion eliminerer enhver mulighed for at indtaste en forkert formateret email adresse..
Den kan eventuelt omskrives til JavaScript hvis man foretrækker client-side validering.
<%
Function validateEmail(strEmail) 'returnerer false hvis adressen er ugyldig
validateEmail = True
varEmailLength = Len(strEmail)
If varEmailLength < 6 Then
validateEmail = False
End If
If InStr(1, strEmail, "@", 1) < 2 Then
validateEmail = False
End If
If InStr(1, strEmail, ".", 1) = 0 Then
validateEmail = False
End If
pos = InStr(1, strEmail, "@", 1)
If InStr(1, strEmail, ".", 1) = pos+1 Then
validateEmail = False
End If
If InStr(1, strEmail, ".", 1) > varEmailLength-2 Then
validateEmail = False
End If
If pos < 2 Then
validateEmail = False
Else
pos = InStr(pos+1, strEmail, "@")
If pos > 0 Then
validateEmail = False
End If
End If
End Function
%>
|