forked from Wavyzz/dolibarr
Ajout fonction pour vrifier les emails
This commit is contained in:
@@ -38,6 +38,51 @@
|
||||
Ensemble de fonctions de base de dolibarr sous forme d'include
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
valid_email() checks the basic syntax of an email address and returns true/false.
|
||||
|
||||
Distributed by Nick Brandt (nick@nbrandt.com)
|
||||
Last modified 27/Feb /2003 1:15
|
||||
*/
|
||||
function valid_email($email) {
|
||||
if (ereg("^([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[.]([0-9,a-z,A-Z]){2}([0-9,a-z,A-Z])*$",$email)) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function ValidEmail($address)
|
||||
{
|
||||
if( ereg( ".*<(.+)>", $address, $regs ) ) {
|
||||
$address = $regs[1];
|
||||
}
|
||||
if(ereg( "^[^@ ]+@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-]{2}|net|com|gov|mil|org|edu|int)\$",$address) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
function check_mail ($mail)
|
||||
{
|
||||
list($user, $domain) = split("@", $mail, 2);
|
||||
if (checkdnsrr($domain, "MX"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
\brief Envoi des messages dolibarr dans syslog.
|
||||
@@ -46,6 +91,9 @@
|
||||
Le \a message est envoy<6F> dans syslog dans la cat<61>gorie LOG_USER.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
function dolibarr_syslog($message, $level=LOG_ERR)
|
||||
{
|
||||
openlog("dolibarr", LOG_PID | LOG_PERROR, LOG_USER); # LOG_USER au lieu de LOG_LOCAL0 car non accept<70> par tous les PHP
|
||||
|
||||
Reference in New Issue
Block a user