View previous topic :: View next topic |
Author |
Message |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Wed Jul 03, 2002 6:09 am Post subject: Basic Email Validation for CGI |
|
|
%A contains the email address being submitted to your form. The label "BadEmail" would be where you send the script to print whatever html back to the user to let them know that the email they are trying to submit is not valid.
This is only a basic email validation routine and it only checks to insure that the format of the email address being submitted is correct. If you want, from here you could go as far as adding DNS Lookup to see if the domain for the email address is valid.
Code: | If @null(%A)
REM - No email address at all
Goto BadEmail
End
Option DecimalSep,.
Option Fieldsep,@chr(64)
Parse "%P;%S",%A
%D = @name(%S)
%E = @ext(%S)
If @null(%P)
REM - Missing Username in the email address
Goto BadEmail
End
If @null(%D)
REM - Missing Domain Name
Goto BadEmail
End
If @null(%E)
REM - Missing Extension (.com and such)
Goto BadEmail
End |
|
|
Back to top |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Jul 03, 2002 6:19 am Post subject: |
|
|
You can also stack these:
Code: |
if @null(%P)
goto BadEmail
end
if @null(%D)
goto BadEmail
end
if @null(%E)
goto BadEmail
end
|
Into one IF/END like this:
Code: |
if @null(%P)@null(%D)@null(%E)
goto BadEmail
end
|
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
|
|
Back to top |
|
|
|