XoopsCore icon indicating copy to clipboard operation
XoopsCore copied to clipboard

Add an human question for the subscription (in order to block robot, and spammers)

Open alain01 opened this issue 11 years ago • 0 comments

Explanation : the webmaster could configure a question and an human answer for the subscription use the profile module : Modify the file include/forms.php and search this line : [code] $elements[0][] = array('element' => new XoopsFormPassword(_US_VERIFYPASS, 'vpass', 35, 32, ''), 'required' => true); $weights[0][] = 0; [/code]

Add just after : [code]
global $xoopsModuleConfig; $elements[0][] = array('element' => new XoopsFormLabel(_QUESTION_ANTI_ROBOT, $xoopsModuleConfig['profile_questionn'])); $weights[0][] = 0; $elements[0][] = array('element' => new XoopsFormText(_REPONSE_AU_QUESTION_ANTIBOT, 'question', 35, 32, ''), 'required' => true); $weights[0][] = 0; [/code]

Then modify the file register.php and search the line : [code] $vpass = isset($_POST['vpass']) ? $myts->stripSlashesGPC(trim($_POST['vpass']) ) : ''; [/code]

and add just after : [code] $question = isset($_POST['question']) ? $myts->stripSlashesGPC(trim($_POST['question']) ) : ''; global $xoopsModuleConfig; if ( (isset($question)) && ($question != $xoopsModuleConfig['profile_reponse']) ) { $stop .= _US_REPONSEAUQUESTIONESTFAUX . '
'; } [/code]

Then modify the file xoops_version.php, add : [code] $modversion['config'][2]['name'] = 'profile_question'; $modversion['config'][2]['title'] = '_PROFILE_MI_PROFILE_QUESTION'; $modversion['config'][2]['description'] = ''; $modversion['config'][2]['formtype'] = 'textbox'; $modversion['config'][2]['valuetype'] = 'text'; $modversion['config'][2]['default'] = 'Where is the town Paris??';

$modversion['config'][3]['name'] = 'profile_reponse'; $modversion['config'][3]['title'] = '_PROFILE_MI_PROFILE_REPONSE'; $modversion['config'][3]['description'] = ''; $modversion['config'][3]['formtype'] = 'textbox'; $modversion['config'][3]['valuetype'] = 'text'; $modversion['config'][3]['default'] = 'France'; [/code]

in the file language/main.php, add : [code] define("_REPONSE_AU_QUESTION_ANTIBOT", "La reponse pour la question est:"); define("_US_REPONSEAUQUESTIONESTFAUX", "Votre reponse au question est faux. ressayez encore une fois"); define("_QUESTION_ANTI_ROBOT", "Question Anti Robots, Prouve que vous etes humain"); [/code]

Thanks to olivee, french xoopser (http://www.frxoops.org/modules/newbb/viewtopic.php?post_id=231287#forumpost231287)

alain01 avatar Oct 29 '13 23:10 alain01