]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
New feature: add antispam question to register (configurable in config file)
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>
Fri, 11 Jan 2008 08:58:28 +0000 (08:58 +0000)
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>
Fri, 11 Jan 2008 08:58:28 +0000 (08:58 +0000)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@8 b3834d28-1941-0410-a4f8-b48e95affb8f

config.inc.php.example
register.php
templates/register.tpl.php

index 648f03d5c5f963add3500840a59cdd227259f842..ce7bcdeab3b6bd67ce7d1261f4bde5c2245a1ca3 100644 (file)
@@ -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');
 ?>
index 8549d05c2e6d0495bbb6f88f67dc733f69ca4675..956efba9e6afc5b6c116402fbdbb32df59f37c87 100644 (file)
@@ -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');
index 7160535422b1fbbf032a192f26cd238137bf68a4..7691a9546536a13721c30135ab6e0a78bf6f252b 100644 (file)
@@ -27,6 +27,15 @@ window.onload = function() {
     <td><input type="text" id="email" name="email" size="40" class="required" /></td>
     <td></td>
 </tr>
+
+<?php if(strlen($antispamQuestion)>0) {?>
+<tr>
+    <th align="left"><label for="question"><?php echo T_('Antispam question'); ?></label></th>
+    <td><input type="text" id="antispamAnswer" name="antispamAnswer" size="40" class="required" value="<?php echo $antispamQuestion ?>"/></td>
+    <td></td>
+</tr>
+<?php } ?>
+
 <tr>
     <td></td>
     <td><input type="submit" name="submitted" value="<?php echo T_('Register'); ?>" /></td>
@@ -37,4 +46,4 @@ window.onload = function() {
 
 <?php
 $this->includeTemplate($GLOBALS['bottom_include']);
-?>
\ No newline at end of file
+?>