Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Email Address Validation

Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
01-30-2008 20:53
Does anyone have a routine to validate an email address supplied? Search in this forum appears to be down right now.
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
01-31-2008 01:09
Do you want a SLS-method, or a PHP-method? :)

in PHP, you'd do something like:

CODE


if($email != "" && ereg("@", $email) && ereg(".", $email))
{
$address = explode("@", $email); // split the address

if(checkdnsrr($address[1], "ANY") == TRUE) // Check the host part
{
$ok = 1;
}
else
{
$ok = 0;
}
}
else
{
$ok = 0;
}

echo $ok;

Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
01-31-2008 01:50
CODE

integer fValidateEmail( string input ){
list firstBreak = llParseString2List( input, [], (list)"@" );
if (2 == llGetListLength( firstBreak )){
//-- optional: some test for illegal characters in the first and last parts, probably a character walk and index vs a string of invalids)
list secondBreak = llParseString2List( llList2String( firstBreak, -1 ), [], (list)"." );
if (3 <= llGetListLength( secondBreak )){
//-- optional: another test checking the domain ending is a valid TLD
return 1;
}
}
return 0;
}

not perfect but workable... of course it'll pass
@@...
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
01-31-2008 08:39
Cheers, thanks guys!

It's exactly what I was hoping for -- something concise that left room in the script memory for, um, the actual email address :}