mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
valid_email :: check if domain part is real
this can be used as an intermediate 'patch' util there is a validation system in place. the extra check is to verify that the domain part of a correctly formatted email address is existing and in use. this will not at all stop spammers since they can use bogus emails with valid domain parts Lukas: Minor formatting changes. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
1f36664e9f
commit
0a1e1729d9
1 changed files with 12 additions and 1 deletions
|
@ -80,7 +80,18 @@ function check_sid($dbh=NULL) {
|
||||||
# verify that an email address looks like it is legitimate
|
# verify that an email address looks like it is legitimate
|
||||||
#
|
#
|
||||||
function valid_email($addy) {
|
function valid_email($addy) {
|
||||||
return (filter_var($addy, FILTER_VALIDATE_EMAIL) !== false);
|
// check against RFC 3696
|
||||||
|
if (filter_var($addy, FILTER_VALIDATE_EMAIL) === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check dns for mx, a, aaaa records
|
||||||
|
list($local, $domain) = explode('@', $addy);
|
||||||
|
if (!(checkdnsrr($domain, 'MX') || checkdnsrr($domain, 'A') || checkdnsrr($domain, 'AAAA'))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
# a new seed value for mt_srand()
|
# a new seed value for mt_srand()
|
||||||
|
|
Loading…
Add table
Reference in a new issue