Verfasst: 09.02.2006 16:15
ok, danke
phpBB.de - Die deutsche phpBB-Community
https://www.phpbb.de/community/
Code: Alles auswählen
ERROR_REPORTING(E_ALL);
// E-Mailadess
$Mail = "witzigerkiller@aol.com";
// Mail will explode
$mail_check_at = explode("@",$Mail);
$mail_check_dot = explode(".",$mail_check_at[1]);
// query mailadress
if (mail_check_length($mail_check_at,$mail_check_dot) == true)
{
echo "richtig";
}
else
{
echo "falsch";
}
// function to check the length of the mail
function mail_check_length($mail_check_at,$mail_check_dot)
{
if ($mail_check_at[0] >=2 && $mail_check_dot[0] >=3 && $mail_check_dot[1] >=2)
{
return true;
}
else
{
return false;
}
}
Code: Alles auswählen
<?PHP
//
// Time of beginning loading this page
//
$starttime = microtime();
ERROR_REPORTING(E_ALL);
//
// mailadress
//
$Mail = "asasa@sasas-swssas.coop"; // Wenn dann hier ändern
function mail_valide(&$Mail)
{
//
// function to check the length of the mail
//
function mail_check_length($mail_check_at,$mail_check_dot)
{
if (strlen($mail_check_at[0]) >=2 && strlen($mail_check_dot[0]) >=3 &&
strlen($mail_check_dot[1]) >=2)
{
return true;
}
else
{
return false;
}
}
//
// function to check the ending of the mail
//
function mail_check_ending($mail_check_dot)
{
$check_ending = array(
"de",
"aero",
"arpa",
"biz",
"com",
"coop",
"edu",
"gov",
"info",
"int",
"jobs",
"mil",
"mobi",
"museum",
"name",
"net",
"org",
"pro",
"travel");
$in_array = FALSE;
foreach ($check_ending as $mail_check)
{
if ($mail_check == $mail_check_dot[1])
{
$in_array = TRUE;
break;
}
}
return $in_array;
}
//
// Mail will explode
//
@$mail_check_at = explode("@",$Mail);
@$mail_check_dot = explode(".",$mail_check_at[1]);
//
// query mailadress
//
if (@mail_check_length($mail_check_at,$mail_check_dot) == true &&
@mail_check_ending($mail_check_dot) == true)
{
echo "Deine E-Mailadresse ist eine korrekte E-Mail";
}
else
{
echo "Deine E-Mailadresse ist eine inkorrekte E-Mail";
}
}
mail_valide($Mail);
//
// output time generation
//
$time = microtime() - $starttime;
echo "<br /><br />Die E-Mailüberprüfung dauerte <b>".$time."</b> Sekunden";
?>