|
This function checks email for validity: check for '@', '.' characters and bad characters that you can define yourself.
-
<?php
-
#############################################################
-
# This function checks email for validity5:
-
# check for '@', '.' characters and bad characters that you
-
# can define yourself.
-
# Contact us at:
This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
-
# Welcome to our Web site at http://php.inc.ru
-
#############################################################
-
function check_email($email)
-
{
-
-
$atSign = false;
-
$dotSign = false;
-
$badCharacter = false;
-
$validEmail = true;
-
-
-
-
{
-
$atSign = true;
-
}
-
-
{
-
$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;
-
}
-
}
-
?>
|