About Dice Captcha

Processwire Dice Captcha

Category 1Development Tools
Modules that have more to do with assisting development of a site rather than managing its content.
Category 2Input Fields
Inputfield modules that provide a UI input widget in the ProcessWire admin.
Category 3Markup Generation
Markup modules that are called upon to generate or parse markup (like HTML). Markup modules are most often used on the front-end of a site (rather than admin).
Category 4Other Modules
Modules that have a unique purpose not covered by existing categories.
Release StateAlpha
Non-stable. Not yet intended for use in production environments. *
Authorrot
Module Version0.1.2
Class NameFormDiceCaptcha
Compatibility2.5, 2.6, 2.7
Date AddedApril 4, 2015
Last UpdatedApril 20, 2015
Recommended ByNew recommendations may take up to 1 day to appear.

Details

This is a simple Processwire Module.

@copyright 2015, Roman Seidl
Licensed under GNU Lesser General Public License, Version 3, see LICENSE.TXT

It allows you to show a simple dice captcha in a form.

If you want you can change the jpg files and adapt the size setting in the module accordingly. This should also increase security as if you use more complex images they will be harder to recognize. You can als change the number of dices asked for.

Instructions

This module's files should be placed in /site/modules/FormDiceCaptcha/
How to install or uninstall modules

README

Dice Captcha

Processwire Dice Captcha Module

This is a simple Processwire Module.

@copyright 2015, Roman Seidl
Licensed under GNU Lesser General Public License, Version 3, see LICENSE.TXT

1 2 3 4 5 6

This module allows you to ask a simple captcha question based on images of dice (6 sided). This could look as follows:
screenshot

The shown dice are a temporary image that gets constructed on a first call. The correct answer is stored to the session. Just add a an image pointing to $dice->captcha() to your form and check the input by using $dice->validate() after submit:

<?php
//Init Module
$dice = $modules->get("FormDiceCaptcha");

//On submit check if the validation is correct
if($input->post->submit) {
    //validate - the value is stored in the session
    if(!$dice->validate($input->post->captcha))
      echo "<p class='error'>".__("Please check that you have completed all fields")."</p>";
    else
      echo "Success!";
}

<form method="post" action="./">
  <!--Show captcha -->
  <img src="$dice->captcha()"/>
  How much is the sum of the dice?
  <!--ask for sum -->
  <input type="text" name="captcha" value="$form[captcha]"/>
  <input type="submit" name="submit" value="submit">
</form>

You are be able to change the image size and the number of dice in the module config interface.

If you want you can change the jpg files and adapt the size setting in the module accordingly. This should also increase security as if you use more complex images they will be harder to recognize.

In case you want a pretty interface you could take pictures of real dice. If you want to try this I recommend you to take 6 dice and place them in a row against a white background. Then use some light source not too hard and not too close from the upper left (nw) corner (could be sunlight if you wait for the right time of the day) and take a picture. Don't use a wide angle lens as it will lead to inconsistencies between the dice. Then take this single image adjust color and contrast and cut out the dice into square images of the same size.

The result can look like this:
dice

Comments

No comments yet. Be the first to post!

Post a Comment

Your e-mail is kept confidential and not included with your comment. Website is optional.