From 5dc06c320a9d026a291709d07a0fba8fa9cd0600 Mon Sep 17 00:00:00 2001 From: mensonge Date: Fri, 11 Jan 2008 08:58:28 +0000 Subject: [PATCH] New feature: add antispam question to register (configurable in config file) git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@8 b3834d28-1941-0410-a4f8-b48e95affb8f --- config.inc.php.example | 6 ++++++ register.php | 5 +++++ templates/register.tpl.php | 11 ++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/config.inc.php.example b/config.inc.php.example index 648f03d..ce7bcde 100644 --- a/config.inc.php.example +++ b/config.inc.php.example @@ -84,6 +84,9 @@ $dbname = 'scuttle'; # filetypes : An array of bookmark extensions that Scuttle should # add system tags for. # reservedusers : An array of usernames that cannot be registered +# +# antispamQuestion: A question to avoid spam +# antispamAnswer: The answer to the question (users have to put exactly the same answer) ###################################################################### $sitename = 'SemanticScuttle'; @@ -118,5 +121,8 @@ $filetypes = array( ); $reservedusers = array('all', 'watchlist'); +$antispamQuestion = 'Put here the answer to 1 + 2 + 3'; +$antispamAnswer = '6'; + include_once('debug.inc.php'); ?> diff --git a/register.php b/register.php index 8549d05..956efba 100644 --- a/register.php +++ b/register.php @@ -44,6 +44,10 @@ if ($_POST['submitted']) { } elseif (!$userservice->isValidEmail($_POST['email'])) { $tplVars['error'] = T_('E-mail address is not valid. Please try again.'); + // Check if antispam answer is valid + } elseif (strcmp($antispamAnswer, $GLOBALS['antispamAnswer']) != 0) { + $tplVars['error'] = T_('Antispam answer is not valid. Please try again.'); + // Register details } elseif ($userservice->addUser($posteduser, $_POST['password'], $_POST['email'])) { // Log in with new username @@ -57,6 +61,7 @@ if ($_POST['submitted']) { } } +$tplVars['antispamQuestion'] = $GLOBALS['antispamQuestion']; $tplVars['loadjs'] = true; $tplVars['subtitle'] = T_('Register'); $tplVars['formaction'] = createURL('register'); diff --git a/templates/register.tpl.php b/templates/register.tpl.php index 7160535..7691a95 100644 --- a/templates/register.tpl.php +++ b/templates/register.tpl.php @@ -27,6 +27,15 @@ window.onload = function() { + +0) {?> + + + + + + + @@ -37,4 +46,4 @@ window.onload = function() { includeTemplate($GLOBALS['bottom_include']); -?> \ No newline at end of file +?>