com web/wiki: OMG add tiny spam protection: dokuwiki/inc/auth.php dokuwiki/inc/html.php
| From: | Hannes Magnusson | Date: | Thu, 28 Nov 2013 09:32:42 +0000 |
| Subject: | com web/wiki: OMG add tiny spam protection: dokuwiki/inc/auth.php dokuwiki/inc/html.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-17260@lists.php.net to get a copy of this message | ||
Commit: f02d0d7df7534752753e23322d0de22b59880826
Author: Hannes Magnusson <bjori@mongodb.com> Thu, 28 Nov 2013 01:32:42 -0800
Parents: bb9f3e1577d9288283b8fbe95335cada8744c6eb
Branches: master
Link: http://git.php.net/?p=web/wiki.git;a=commitdiff;h=f02d0d7df7534752753e23322d0de22b59880826
Log:
OMG add tiny spam protection
Changed paths:
M dokuwiki/inc/auth.php
M dokuwiki/inc/html.php
Diff:
diff --git a/dokuwiki/inc/auth.php b/dokuwiki/inc/auth.php
index b793f5d..8c81355 100644
--- a/dokuwiki/inc/auth.php
+++ b/dokuwiki/inc/auth.php
@@ -921,11 +921,12 @@ function register() {
// gather input
$login = trim($auth->cleanUser($INPUT->post->str('login')));
$fullname = trim(preg_replace('/[\x00-\x1f:<>&%,;]+/', '',
$INPUT->post->str('fullname')));
+ $spam = trim(preg_replace('/[\x00-\x1f:<>&%,;]+/', '',
$INPUT->post->str('spam')));
$email = trim(preg_replace('/[\x00-\x1f:<>&%,;]+/', '',
$INPUT->post->str('email')));
$pass = $INPUT->post->str('pass');
$passchk = $INPUT->post->str('passchk');
- if(empty($login) || empty($fullname) || empty($email)) {
+ if(empty($login) || empty($fullname) || empty($email) || empty($spam)) {
msg($lang['regmissing'], -1);
return false;
}
@@ -945,6 +946,12 @@ function register() {
msg($lang['regbadmail'], -1);
return false;
}
+ // make sure the secret spam box was filled out correctly
+ if($spam != "php-webmaster@lists.php.net") {
+ msg("That wasn't the answer we were expecting",-1);
+ return false;
+ }
+
//okay try to create the user
if(!$auth->triggerUserMod('create', array($login, $pass, $fullname, $email))) {
diff --git a/dokuwiki/inc/html.php b/dokuwiki/inc/html.php
index 7f473cd..55e9b03 100644
--- a/dokuwiki/inc/html.php
+++ b/dokuwiki/inc/html.php
@@ -1325,6 +1325,7 @@ function html_register(){
}
$form->addElement(form_makeTextField('fullname',
$INPUT->post->str('fullname'), $lang['fullname'], '',
'block', $base_attrs));
$form->addElement(form_makeField('email','email',
$INPUT->post->str('email'), $lang['email'], '',
'block', $email_attrs));
+ $form->addElement(form_makeTextField('spam', $_POST['spam'], "Which
email address do you have to mail now?", '', 'block',
array('size'=>'50')));
$form->addElement(form_makeButton('submit', '',
$lang['btn_register']));
$form->endFieldset();
html_form('register', $form);