Math captcha for preventing spam in posts
Posted by Mensler
All files from this thread
File Name | File Size | Posted by | Date | ||
---|---|---|---|---|---|
mathcaptcha_5.0.x.zip | 2.2 KB | open | download | Mensler | 08/21/2006 | Read message |
mathcaptcha_5.1.x.zip | 2.6 KB | open | download | Mensler | 12/04/2006 | Read message |
czech.php | 317 bytes | open | download | xJERRYx | 07/18/2006 | Read message |
Math captcha for preventing spam in posts July 07, 2006 07:55PM |
Registered: 19 years ago Posts: 152 |
Hi,
I was searching for a non-graphical captcha for my Phorum and first tried sheik's one. What I don't like is the file generation as I'm not able to use cronjobs on my server.
So I tried myself and developed a math captcha module for the post form of unregistered users. It works without files, writing to the database or to cookies.
The sum of the two random numbers is saved in a hidden field in the post form, MD5-encoded with a security key specified in the module settings.
There are different versions for Phorum 5.0 and 5.1.
To install it, simply copy the mathcaptcha folder in your mods folder, enable it in admin and check the settings.
If you're using Phorum 5.0.x you have to add the following lines (according to your template) to your post_form.tpl between the <form> and </form> tags:
If you're using Phorum 5.1.x with customized templates maybe you'd like to change the HTML code for the form elements in mathcaptcha.php. The module uses the tpl_editor_after_subject hook to show the form elements.
Please try it out if you like and tell me what you think about it.
Friendly greetings
--
Clemens Weiß
Webplain.de
Edited 7 time(s). Last edit at 12/04/2006 02:08AM by Mensler.
I was searching for a non-graphical captcha for my Phorum and first tried sheik's one. What I don't like is the file generation as I'm not able to use cronjobs on my server.
So I tried myself and developed a math captcha module for the post form of unregistered users. It works without files, writing to the database or to cookies.
The sum of the two random numbers is saved in a hidden field in the post form, MD5-encoded with a security key specified in the module settings.
There are different versions for Phorum 5.0 and 5.1.
To install it, simply copy the mathcaptcha folder in your mods folder, enable it in admin and check the settings.
If you're using Phorum 5.0.x you have to add the following lines (according to your template) to your post_form.tpl between the <form> and </form> tags:
{IF LOGGEDIN false} <tr> <td colspan="2"> <input type="hidden" name="spamprotection" value="{mod_mathcaptcha->checkstring}" /> {LANG->mod_mathcaptcha->SpamPrevention}:<br /> {mod_mathcaptcha->number1} + {mod_mathcaptcha->number2} = <input type="text" id="mathcaptcha" name="mathcaptcha" /> </td> </tr> {/IF}
If you're using Phorum 5.1.x with customized templates maybe you'd like to change the HTML code for the form elements in mathcaptcha.php. The module uses the tpl_editor_after_subject hook to show the form elements.
Please try it out if you like and tell me what you think about it.
Friendly greetings
--
Clemens Weiß
Webplain.de
Edited 7 time(s). Last edit at 12/04/2006 02:08AM by Mensler.
Re: Math captcha for preventing spam in posts July 11, 2006 04:15AM |
Registered: 21 years ago Posts: 687 |
Cool!
My initial design for my non-graphical CAPTCHA was also based on simple arithmetic. I changed to words though because a) I thought it would be harder to write a bot to crack it, and b) I thought it would be more fun :-)
I'm not in love with the fact my module uses files either. I wonder if I should look into modifying it to use your checksum idea...
Just a question though, what security is there to stop a script from using its own POST form, with say a blank checksum. Do you check for that?
/\dam
--
My notable Phorum sites:
Movie Deaths Database - "review comments" system mostly powered by Phorum
Learn Chinese! - integrated forum quiz
My initial design for my non-graphical CAPTCHA was also based on simple arithmetic. I changed to words though because a) I thought it would be harder to write a bot to crack it, and b) I thought it would be more fun :-)
I'm not in love with the fact my module uses files either. I wonder if I should look into modifying it to use your checksum idea...
Just a question though, what security is there to stop a script from using its own POST form, with say a blank checksum. Do you check for that?
/\dam
--
My notable Phorum sites:
Movie Deaths Database - "review comments" system mostly powered by Phorum
Learn Chinese! - integrated forum quiz
Re: Math captcha for preventing spam in posts July 11, 2006 05:06AM |
Registered: 18 years ago Posts: 67 |
Re: Math captcha for preventing spam in posts July 11, 2006 06:24AM |
Registered: 19 years ago Posts: 152 |
Quote
sheik
Just a question though, what security is there to stop a script from using its own POST form, with say a blank checksum. Do you check for that?
Hi Adam,
it's not necessary to explicitly check for that, as the checksum of the result is still built and then compared with an empty string.
Greetings,
Clemens
--
Clemens Weiß
Webplain.de
Re: Math captcha for preventing spam in posts July 11, 2006 08:33AM |
Registered: 19 years ago Posts: 152 |
Quote
katlu
Hm. I just tried it in 5.1.14, but I can enter whatever number I want, and my post is accepted ("7+9=2"). I placed the text at the beginning of posting_messageform.tpl. Maybe I should put it at the end?
It seems that the pre_post hook is not called anymore.
Unfortunately I have not enough time to test it with a new installation, maybe next week...
--
Clemens Weiß
Webplain.de
Re: Math captcha for preventing spam in posts July 11, 2006 01:12PM |
Admin Registered: 19 years ago Posts: 8,532 |
I investigated and this module won't work on Phorum 5.1 in this form.
Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Math captcha for preventing spam in posts (Phorum 5.0 only) July 17, 2006 04:20PM |
Registered: 18 years ago Posts: 12 |
Re: Math captcha for preventing spam in posts July 17, 2006 05:26PM |
Registered: 19 years ago Posts: 152 |
Hi,
here's a second version of the module which should work for Phorum 5.1.x.
Please feel free to test it and comment on it.
EDIT: I attached the file to my first post. Phorum 5.1 is great :-)
Greetings,
Clemens
--
Clemens Weiß
Webplain.de
Edited 1 time(s). Last edit at 07/17/2006 05:40PM by Mensler.
here's a second version of the module which should work for Phorum 5.1.x.
Please feel free to test it and comment on it.
EDIT: I attached the file to my first post. Phorum 5.1 is great :-)
Greetings,
Clemens
--
Clemens Weiß
Webplain.de
Edited 1 time(s). Last edit at 07/17/2006 05:40PM by Mensler.
Re: Math captcha for preventing spam in posts (Phorum 5.0 only) July 17, 2006 05:49PM |
Registered: 19 years ago Posts: 152 |
Hi Jerry,
are you sure you entered the above code correctly (with both input fields, the hidden and the text one) in your template?
Can I see it somewhere online?
Just copy one of the language files, rename it to czech.php and change the strings (and post it here afterwards :-)).
Remember that in your installation the module language file needs to have the same name as the general language file (e.g. if your general language file is "czech-5.0.16.php" you have to rename the module language file the same way).
Greetings,
Clemens
--
Clemens Weiß
Webplain.de
Quote
xJERRYx
I use Phorum 5.0.16 and this mod does not work :o( It does not accept correct results and finds them incorrect.
are you sure you entered the above code correctly (with both input fields, the hidden and the text one) in your template?
Can I see it somewhere online?
Quote
xJERRYx
An I don't know how to change the language file e. g. to czech.php. I must use name english.php with czech translation. Sorry, I'm not programmer :o)))
Just copy one of the language files, rename it to czech.php and change the strings (and post it here afterwards :-)).
Remember that in your installation the module language file needs to have the same name as the general language file (e.g. if your general language file is "czech-5.0.16.php" you have to rename the module language file the same way).
Greetings,
Clemens
--
Clemens Weiß
Webplain.de
Re: Math captcha for preventing spam in posts July 18, 2006 02:37AM |
Registered: 18 years ago Posts: 12 |
Hello Mensler ;o)
My phorum is there: [psychologie.oukej.cz] - it still does not work :o( I think everithing is done as you wrote.
THX 4 help. Problem with language file was in the name, THX ;o)
Jerry
My phorum is there: [psychologie.oukej.cz] - it still does not work :o( I think everithing is done as you wrote.
THX 4 help. Problem with language file was in the name, THX ;o)
Jerry
Sorry, only registered users may post in this forum.