If I have a form where a user needs to put in an email address, how can I test that to make sure that it is in fact an email address (something@somewhere) and not just crap(crapcrapcrap)
Validating an email address
Started by kromagnon, Jul 21 2006 09:28 AM
2 replies to this topic
#1
Posted 21 July 2006 - 09:28 AM
|
|
|
#2
Guest_Jordan_*
Posted 21 July 2006 - 10:22 AM
Guest_Jordan_*
<?PHP
///////////////////////////////////////////////////////////////////////
// Author: Jordan
// Date: 9-30-05
// Copyright: 2005
// Description: Validates email addresses inside
// of a function call
///////////////////////////////////////////////////////////////////////
// take a given email address and split it into the
// username and domain.
function ValidateEmail($v_email)
{
list($v_userName, $v_mailDomain) = split("@", $v_email);
if (ValidateEmail2($v_mailDomain, "MX")) {
// this is a valid email domain!
return true;
}
else {
// this email domain doesn't exist! bad dog! no biscuit!
return false;
}
}
?>
#3
Posted 30 July 2006 - 07:24 AM
Jordan, you have a function in there ValidateEmail2 that isn't in your code above. This function wont run.


Sign In
Create Account


Back to top









