我有我的代碼如下,我能夠驗證域名,但無法驗證用戶名,即使域名是有效的。如何驗證電子郵件地址的用戶名?
例如:
[email protected] --- valid domain valid username ---- pass
[email protected] ----- valid domain invalid username ---- failed
感激,如果任何人都可以提供幫助。
function domain_exists($email, $record = 'MX'){
list($user, $domain) = preg_split('/@/', $email);
return checkdnsrr($domain, $record);}
if(!domain_exists($email)){
echo "<script type='text/javascript'>window.alert('No have such email,invalid Domain. please enter valid email address!')</script>";
echo "<script type='text/javascript'>window.location='register.html'</script>";
exit;}
function user_exists($email, $record = 'MX'){
list($user, $domain) = preg_split('/@/', $email);
return checkdnsrr($user, $record);}
if(!user_exists($email)){
echo "<script type='text/javascript'>window.alert('No have such user, please enter valid email address!')</script>";
echo "<script type='text/javascript'>window.location='register.html'</script>";
exit;}
我很確定DNS不包含電子郵件*用戶信息* ... –
有沒有成功的方法來使用戶名無效就像那樣..儘管你可以爲這樣的用戶名製作黑名單 –