Forum Spam
Forum Spam
Hi Madshi,
I noticed all the spam your wasting time deleting and thought I would let you know of a free mod for phpbb2 that I use to stop the spam from bots... have a look at the image for the registration on my forum here:
http://forum.canberrarcdrift.com
The mod is called CAPTCHA, you could either use that or you could implement somthing like what php.net use when posting... asks a simple question like "min(5, 4)?", or "4 - 5 + min(2, 4)".
I noticed all the spam your wasting time deleting and thought I would let you know of a free mod for phpbb2 that I use to stop the spam from bots... have a look at the image for the registration on my forum here:
http://forum.canberrarcdrift.com
The mod is called CAPTCHA, you could either use that or you could implement somthing like what php.net use when posting... asks a simple question like "min(5, 4)?", or "4 - 5 + min(2, 4)".
Re: Forum Spam
Thanks!
Is that an alternative captcha thing? Is it good enough so that OCR bots fail?gnif wrote:The mod is called CAPTCHA
Actually I was thinking about adding something like this... Do you have a link or documentation on how to add such a simple question? That would be great!gnif wrote:or you could implement somthing like what php.net use when posting... asks a simple question like "min(5, 4)?", or "4 - 5 + min(2, 4)".
Yes, it replaces the original, I still get the odd bot registring, but it cut down the number by 80-90%.Is that an alternative captcha thing? Is it good enough so that OCR bots fail?
Unfortunatly no, but It shouldnt be hard to write somthing to do this, I can have a look at this for you if you like... php is my 2nd programming language(To delphi).o you have a link or documentation on how to add such a simple question?
Hold on, I just remembered, the php website is opensource, just go have a look at how they do it.
update: here it is
update: here it is
Code: Select all
<?php
// $Id: spam_challenge.php,v 1.1 2006/07/05 15:51:45 nlopess Exp $
// simple and stupid SPAM protection (using little challenges)
$nums = array('zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine');
function plus($a, $b) {
return $a + $b;
}
function gen_plus($a) {
return rand(0, 9 - $a);
}
function minus($a, $b) {
return $a - $b;
}
function gen_minus($a) {
return rand(0, $a);
}
function print_infix($name, $a, $b) {
return "$a $name $b";
}
function print_prefix($name, $a, $b) {
return "$name($a, $b)";
}
$challenges = array(
// name, print, generator
array('max', 'print_prefix'),
array('min', 'print_prefix'),
array('minus', 'print_infix', 'gen_minus'),
array('plus', 'print_infix', 'gen_plus'),
);
// generate a challenge
function gen_challenge() {
global $challenges, $nums;
$c = $challenges[rand(0, sizeof($challenges)-1)];
$a = rand(0, 9);
$an = $nums[$a];
$b = isset($c[2]) ? $c[2]($a) : rand(0, 9);
$bn = $nums[$b];
return array($c[0], $an, $bn, $c[1]($c[0], $an, $bn));
}
// test an answer for validity
function test_answer($name, $an, $bn, $answer) {
global $challenges, $nums;
foreach ($challenges as $x) {
if ($x[0] === $name) {
$c = $x;
break;
}
}
$a = array_search($an, $nums);
$b = array_search($bn, $nums);
if (empty($c) || $a === false || $b === false) return false;
return ($nums[$c[0]($a, $b)] === $answer);
}
?>
I have it working on my site here... have a look.
http://forum.canberrarcdrift.com/profil ... greed=true
To make it work... do the following:
in the "includes" directory, make the file "txt_verification.php" and put the below in it.
Then, edit the file "includes/usercp_register.php" and at line 42, just before the line "$unhtml_specialchars_match = ..." add the following
At around line 1000 just after the lines
and add the following:
Either remove or comment out any other lines that set the $code variable. and change the line that sets the $confirm_image value to read:
I would give exact line numbers, but my site is already modified and they may be out. All thats left to do is edit the language template file and change the text displayed for the confimation field as it is no longer an image.
edit the file "language/lang_english/lang_main.php" and change the lines that starts with "$lang['Confirm_code_impaired']" and "$lang['Confirm_code_explain']" to read as you see fit.
http://forum.canberrarcdrift.com/profil ... greed=true
To make it work... do the following:
in the "includes" directory, make the file "txt_verification.php" and put the below in it.
Code: Select all
<?php
// $Id: spam_challenge.php,v 1.1 2006/07/05 15:51:45 nlopess Exp $
// simple and stupid SPAM protection (using little challenges)
$nums = array('zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine');
function plus($a, $b) {
return $a + $b;
}
function gen_plus($a) {
return rand(0, 9 - $a);
}
function minus($a, $b) {
return $a - $b;
}
function gen_minus($a) {
return rand(0, $a);
}
function print_infix($name, $a, $b) {
return "$a $name $b";
}
function print_prefix($name, $a, $b) {
return "$name($a, $b)";
}
$challenges = array(
// name, print, generator
array('max', 'print_prefix'),
array('min', 'print_prefix'),
array('minus', 'print_infix', 'gen_minus'),
array('plus', 'print_infix', 'gen_plus'),
);
// generate a challenge
function gen_challenge() {
global $challenges, $nums;
$c = $challenges[rand(0, sizeof($challenges)-1)];
$a = rand(0, 9);
$an = $nums[$a];
$b = isset($c[2]) ? $c[2]($a) : rand(0, 9);
$bn = $nums[$b];
return array($c[0], $an, $bn, $c[1]($c[0], $an, $bn));
}
// test an answer for validity
function test_answer($name, $an, $bn, $answer) {
global $challenges, $nums;
foreach ($challenges as $x) {
if ($x[0] === $name) {
$c = $x;
break;
}
}
$a = array_search($an, $nums);
$b = array_search($bn, $nums);
if (empty($c) || $a === false || $b === false) return false;
return ($nums[$c[0]($a, $b)] === $answer);
}
// generate the answer
function gen_answer($challenge) {
global $challenges, $nums;
foreach ($challenges as $x) {
if ($x[0] === $challenge[0]) {
$c = $x;
break;
}
}
$a = array_search($challenge[1], $nums);
$b = array_search($challenge[2], $nums);
if (empty($c) || $a === false || $b === false) return 'INVALID CHALLENGE';
return $nums[$c[0]($a, $b)];
}
?>
Code: Select all
require_once('txt_verification.php');
Code: Select all
$db->sql_freeresult($result);
// Generate the required confirmation code
// NB 0 (zero) could get confused with O (the letter) so we make change it
Code: Select all
$challenge = gen_challenge();
$code = gen_answer($challenge);
Code: Select all
$confirm_image = $challenge[3];
edit the file "language/lang_english/lang_main.php" and change the lines that starts with "$lang['Confirm_code_impaired']" and "$lang['Confirm_code_explain']" to read as you see fit.
You could also try HumanAuth http://www.gigoit.org/humanauth/ or KittenAuth http://www.kittenauth.com/. They are not crackable by OCR in my opinion.
Regards,
Jim[/url]
Regards,
Jim[/url]