Location: PHPKode > projects > Esp php p2p project > p2p/other/form validation email_id/Email_validation.php
<?
#############################################################
# This function checks email for validity5:
# check for '@', '.' characters and bad characters that you
# can define yourself.
# Contact us at: hide@address.com
# Welcome to our Web site at http://php.inc.ru
#############################################################
function check_email($email)
{
$emailArray = preg_split('//', $email);
     $atSign = false;
     $dotSign = false;
     $badCharacter = false;
     $validEmail = true;


if (in_array ("@", $emailArray))
{
    $atSign = true;
    }
    if (in_array (".", $emailArray))
{
    $dotSign = true;
    }

$badCharactersArray = array('#', '$', '%', '(', ')', '&', '!');    // Add your own bad
                                                                   // characters here;

for ($i = 0; $i < sizeof($badCharactersArray); $i++)
{
if (in_array ($badCharactersArray[$i], $emailArray))
    {
    $badCharacter = true;
    }
}

if ((!$atSign) or (!$dotSign) or ($badCharacter))
        $validEmail = false;
}
?>
Return current item: Esp php p2p project