diff --git a/inc/accounts.php b/inc/accounts.php index e790701..a223167 100644 --- a/inc/accounts.php +++ b/inc/accounts.php @@ -388,11 +388,21 @@ if(!empty($_POST)) { /* Test de validation du formulaire */ if($form->verify(TRUE)) { + $is_domain_present = check_occurence_name($form->getField('domain')->getValue()); + $is_alias_present = check_occurence_name($form->getField('domain_alias')->getValue()); + + if (!$is_domain_present && !$is_alias_present) { if ($conf['cluster']) $exec_info = web_add_cluster($form, $conf['admin']['mail']); else $exec_info = web_add($form, $conf['admin']['mail']); - } + } + else { + $errors_check = array(); + if ($is_domain_present) array_push($errors_check, "Domaine déjà présent dans d'autres vhosts."); + if ($is_alias_present) array_push($errors_check, "Alias déjà présent(s) dans d'autres vhosts."); + } + } } include_once EVOADMIN_BASE . '../tpl/header.tpl.php'; diff --git a/tpl/accounts.tpl.php b/tpl/accounts.tpl.php index 34cc35c..859b442 100644 --- a/tpl/accounts.tpl.php +++ b/tpl/accounts.tpl.php @@ -34,8 +34,15 @@ print ''; } else { -?> + if (isset($errors_check)) { + print '

Erreur(s) :
'; + foreach ($errors_check as $error) { + printf('%s
', $error); + } + print '

'; + } +?>
Ajout d'un compte