Arrow

Peter’s Custom Anti-Spam for input forms Version 1.1

First published on February 24, 2007

I decided to do a spin-off of my custom anti-spam image plugin for WordPress since people kept asking for it to be made available normal forms. Check out the eZ Publish version of this plugin if you are running eZ Publish 3.8+.

So, here it is… version 1.1 contains the features found in version 3.0.3 of the WordPress plugin (such as auto-generated audio for visually impaired users).

Download version 1.1 of Peter’s Custom Anti-Spam for input forms (April 16, 2008)

Previous releases:
February 24th, 2007: Version 1.0 (used by some savings institute)

Requirements

  • PHP 4 or 5
  • MySQL 3+
  • GD Library and FreeType Library

Instructions

Note: I am assuming that you have already set up your own input form and that you are using PHP for both the page that displays the input form and the script that processes the form. Here’s an example input form and an example form processor (both for PHP). These are definitely not the best examples, so I’d advise you to do a web search for other examples! In particular, make sure to always validate input values…

1) Extract all files to a folder on your server, most commonly the same folder that contains the input form and form processor.

2) Update your database connection information in cas_db.php, then run cas_install.php. You can remove cas_install.php once the database tables have been created.

3) Make sure that the temp_sounds folder is writeable.

4) Update settings and translation strings in cas_engine.php.

5) Enter this in your input form (see example_inputform.txt for a basic framework) where you want the anti-spam image to display:

include 'cas_engine.php';
cas_comment_form();

6) Enter this in your form processor (see example_formprocessor.txt for a basic framework):

include 'cas_engine.php';
cas_comment_post();

Arrow

17 Responses to “Peter’s Custom Anti-Spam for input forms Version 1.1”


  1. EMMETT says:

    it gives response:
    Error: Please enter the anti-spam word.
    no matter if entered correctly or not
    http://www.hostgigas.com/contact.php


  2. Peter says:

    Hi, I suspect this is because your form handler is “cgi/formmail” instead of a php file. The way you have your script set up, the form posts to formmail, then redirects to YourEmailReceived.php. The data flow has stopped at cgi/formmail, thus nothing reaches YourEmailReceived.php. If you want to use the anti-spam image, you have to embed it in some sort of php e-mail script that directly receives the input variables.


  3. EMMETT says:

    Thank you for your response
    Yes it is cgi/formmail”, but i have no idea how to implement your solution of embedding, if you cant provide any further help on this then may be I have to turn to netfirms support. The spam i’m getting on my forms is quite unbearable anymore and I believe your script has the solution when it is setup right
    Emmett


  4. Ian Lloyd says:

    Hey Peter. I gave this a whirl as I am inundated with all the kind of crap that I don’t want :-(

    It is not working for me but probably for silly reasons. The image src attribute shows as “cas_engine.php?antiselect=2″ but not image is on screen. What should I be looking for to fix this? Is it perhaps something that I have not got installed in my Apache installation?

    Sorry, no live URL to give you (still on dev)

    If you can help with this, I’d appreciate it but I understand that this is free, so you can’t spend time supporting it (or numpties like me!)


  5. heh says:

    I love your site. Just kidding. Nice try at adsense rev by halting all IE traffic to your comic site. Interop is not your strong suit.


  6. Peter says:

    Oh right. Sorry about that. No comics for you. You can have my crap instead :D


  7. Smith Data Processing Services » Blog Archive » links for 2007-04-13 says:

    [...] Peter’s Useful Crap » Peter’s Custom Anti-Spam for input forms Version 1.0 (tags: php captcha) [...]


  8. Anders Moen says:

    Thanks for this :)


  9. Sergio says:

    Hi, good script, can I ask you with wich type of license you are share it? gnu-gpl? cc?


  10. Peter says:

    Good question. Let’s go with the LGPL. Basically, I want to allow people the freedom to do anything with it that they want (even sell things that use it), except that they must say where they got the code.

    If I ever get the time, I need to update the code with all of the improvements that were made to the WordPress version.


  11. Frank says:

    Hi Peter,
    Very interested in your captcha, but I was disappointed to discover the stand alone version doesn't have the wonderful audio feature the latest WP version has…

    Any chance the stand alone version will be updated, or that you'd give some pointers on how to attempt to implement the wp version as stand alone…?

    many thanks!
    Frank


  12. mgwalk says:

    I think i may try this out nice and clean!


  13. Peter says:

    Hi Frank, sorry for the slow reply. Your comment got stuck in a very odd WordPress hole. Anyway, I will put it on my list to update this standalone version to include audio capabilities.


  14. Peter says:

    Version 1.1 has now been released, with the features such as audio capabilities of the WordPress plugin version 3.0.3.


  15. Remo says:

    I just installed the non-wordpress version of Peter’s Custom Anti-Spam for input forms. A great thing but there’s one annoying thing – the MySQL requirement. There are so little information needed for a captcha, wouldn’t it be better if there’s just a text file that contains all the word, without the need of a database?


  16. Peter says:

    Hi Remo, the first few versions I created used a text file. However, it was too easy to crack since it mapped specific numbers to specific words, and this mapping never changed. To combat this problem, every time someone visits a comment page, a new number (mapping to a word) is generated, which is valid for only one use for 24 hours. A database was more efficient for this purpose and thus I had to trade off easier technical requirements for better efficiency and effectiveness.


  17. Peter says:

    Fantastic script, is there any way to have a sound button included to play the sound rather than download it?

    Reply from Peter: That’s certainly possible, but you’d most likely need to embed some sort of Flash player — something I have not looked at.

Speak your mind

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word