aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-01-11 08:58:28 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-01-11 08:58:28 +0000
commit5dc06c320a9d026a291709d07a0fba8fa9cd0600 (patch)
tree027766082289e7f3cac87e5c3674e81d85a54bac
parent9cbba1119c8817ee5b41a8006042daf5b6c49df1 (diff)
downloadsemanticscuttle-5dc06c320a9d026a291709d07a0fba8fa9cd0600.tar.gz
semanticscuttle-5dc06c320a9d026a291709d07a0fba8fa9cd0600.tar.bz2
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
-rw-r--r--config.inc.php.example6
-rw-r--r--register.php5
-rw-r--r--templates/register.tpl.php11
3 files changed, 21 insertions, 1 deletions
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() {
<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
+?>