diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index b37cb15d9c0..5f5e560c87d 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -83,7 +83,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); $action = GETPOST('action', 'aZ09'); // Load translation files -$langs->loadLangs(array("main", "members", "companies", "install", "other")); +$langs->loadLangs(array("main", "members", "companies", "install", "other", "errors")); // Security check if (empty($conf->adherent->enabled)) { @@ -257,6 +257,17 @@ if (empty($reshook) && $action == 'add') { } } + // Check Captcha code if is enabled + if (!empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) { + $sessionkey = 'dol_antispam_value'; + $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) == strtolower($_POST['code']))); + if (!$ok) { + $error++; + $errmsg .= $langs->trans("ErrorBadValueForCode")."
\n"; + $action = ''; + } + } + $public = GETPOSTISSET('public') ? 1 : 0; if (!$error) { @@ -789,6 +800,20 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW print ''; } + // Display Captcha code if is enabled + if (!empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''.img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"').''; + print ''; + print ''; + } + print "\n"; print dol_get_fiche_end();