Hoşgeldin Misafir

PHP email adresinin kontrolü

SurHan

28 Kas 2017
4,186 Mesaj

Aktiflik

Seviye

Deneyim

TIM / GÖREV:
Herhangi bir formdan girilen bir email adresinin doğru olup olmadığını anlamamıza yarayan güzel bir kod örneğini sunuyoruz--


PHP:
<?

function adreskontrolet ($adres) {
$sonuc = ereg("^[^@ ]+@[^@ ]+\.[^@ \.]+$", $adres,$kayit);
if ($sonuc) { $dogru = "Evet"; } else { $dogru = "Hayir"; }
echo ("e-mail adresiniz : $adres  $dogru <BR>");
}

adreskontrolet ("buadresdogrumucom");
adreskontrolet ("bu [email protected]");
adreskontrolet ("bu@[email protected]");
adreskontrolet ("[email protected]");
?>