Need script for logon.inc for email address

F

FrontPage Novice

I used the following script from Microsoft for logon.inc:

' This function restricts text to alpha-numeric data only.
Function ParseText(TXT)
Dim intPos, strText, intText
For intPos = 1 TO Len(TXT)
intText = Asc(Mid(TXT,intPos,1))
If (intText > 47 And intText < 59) Or _
(intText > 64 And intText < 91) Or _
(intText > 96 And intText < 123) Then
strText = strText & Mid(TXT,intPos,1)
End if
Next
ParseText = strText
End Function

I want to be able to use e-mail addresses for usernames. Does anyone have a
script that will allow e-mail addresses (and all characters)? No Constraints
is selected for the username field, but the script above will not allow
characters. Can anyone help me with this?
 
S

Stefan B Rusynko

See the ASCII table at http://www.asciitable.com/ (Dec and Chr columns) for what is being excluded

To allow the @ (64) - (45) . (46) _ (95) ~ (123)
and still block characters not allowed in an email address
You probably only need to change the script to

If (intText > 47 And intText < 58) Or _
(intText > 63 And intText < 91) Or _
(intText > 96 And intText < 123) Or _
(intText > 44 And intText < 47) Or _
intText = 95 Or intText = 123 Then

You can add any other characters you want in the same way as the last line

The Email spec RFC 822 also allows the following additonal characters in an email address
! # $ % & * + / = ? ^ ` { | }

But I have never seen them used in any email address (that wasn't from a spammer)
and the ' (single quote - 39 ) will probably give you script problems if you add it

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


|I used the following script from Microsoft for logon.inc:
|
| ' This function restricts text to alpha-numeric data only.
| Function ParseText(TXT)
| Dim intPos, strText, intText
| For intPos = 1 TO Len(TXT)
| intText = Asc(Mid(TXT,intPos,1))
| If (intText > 47 And intText < 59) Or _
| (intText > 64 And intText < 91) Or _
| (intText > 96 And intText < 123) Then
| strText = strText & Mid(TXT,intPos,1)
| End if
| Next
| ParseText = strText
| End Function
|
| I want to be able to use e-mail addresses for usernames. Does anyone have a
| script that will allow e-mail addresses (and all characters)? No Constraints
| is selected for the username field, but the script above will not allow
| characters. Can anyone help me with this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top