QCaptcha

Login or register to post comments
8 replies [Last post]
Offline
Joined: 03/24/2009

Hi there,

I am building a web site currently and I need to integrate a Captcha to secure and prevent spam on our public forms.

As such a control don't seem to exist in Qcubed 2.0.1, I would like to get insight and help on how I can construct this in order to include my work to QCubed either as a plugin or a core Control.

Thanks for your help.

Mike

vakopian's picture
Offline
Joined: 04/08/2008

Mike,

Are you thinking to fully implement the captcha functionality in your plugin? Or do you want to use services such as recaptcha? I imagine the latter would be much simpler. For the former, you might get some clues by looking at the drupal captcha module implementation, and see how to port it to QCubed. In fact that module can use recaptcha as well, so it might be interesting either way.

-Vartan

Offline
Joined: 03/24/2009

Yes, I would like to create a class to generate the Captcha. I already found a class that is simple and allow you to add or remove the fonts used to generate the image.

Here's my approach :

Have one PHP file generating a random Captcha Image to display within my QCaptcha control.

Image generation will be influenced by GET variables coming from QCaptcha Control and Captcha Text will be stored in a SESSION variable.

* Width
* Height
* Length of the Captcha
* SESSION variable to store the Captcha String into (to retreive in the Validate method.)

Any other Idea of parameters while I'm at it?

Validate() method should then compare the SESSION value to the User specified value to determine if the Control value is valid and generate proper warning message if the strings are not equal.

For now, I'm not sure if the SESSION is the best way to store the Captcha text... will see as I'm doing some work on this.

alex94040's picture
Offline
Joined: 11/06/2008

This sounds very interesting - I think QCaptcha would make a SUPER useful plugin. Keep us posted, and let me know if you need help!

Offline
Joined: 03/24/2009

I'm pretty much done now I would only need some help to get the plugin into the repository. Do I create and commit myself the Plugin into SVN by creating a folder and subfolder for the source code in the /plugin branch ?

Besides than that, I hope this will be a useful control for everyone. As there's not so much documentation other than some comments in the QCaptchaTextBox file here is a summary of the available options :

/** General Captcha Options */
CssClass => wrapper CSS Class for styling purpose.
intLength => Number of Character visible.
intImageHeight => Height of the image.

/** Captcha color options */
rgbForeColor => Main text Color provided in the following format : array(0, 0, 0).
rgbSignColor => Background sings Color provided in the following format : array(0, 0, 0).
rgbBackgroundColor => Background Color provided in the following format : array(0, 0, 0).

/** Captcha String options */
blnAllowUpperCaseLetter => include Upper case Letters in the generation.
blnAllowLowerCaseLetter => include Upper case Letters in the generation.
blnAllowNumbers => include numbers in the generation.
blnCaseSensitive => Validate character case when Comparing Image text to user Input.

/**Available Image Filters options*/
blnAddSign => Add character in the background to strengthen the Captcha (Default On)
blnAddNoise => Add Noise to the Image. (default off)
blnAddBlur => Add Blur to the Image (Default off)

Thanks for your help.

Mike

alex94040's picture
Offline
Joined: 11/06/2008

Thrilled to hear that!

To share your plugin, follow the instructions in the "Packaging your Plugin" example (http://examples.qcu.be/assets/_core/php/examples/plugins/packaging.php). You can commit the stuff yourself to the /plugins subdirectory - just use your qcu.be credentials.

As far as documentation goes, may I ask you to include an example file with your work? Just look at how all the other plugins do it - a really simple narrative that shows the plugin/control in action.

Offline
Joined: 03/24/2009

Great thanks for the instructions. I work on the example to include the default Captcha and a version with some styling alteration. I just did a checked-in of my plugin in the repository. I also added the plugin description and link to the first release in the plugin page at : http://trac.qcu.be/projects/qcubed/wiki/plugins?version=68

My only question was about how I can link the Demo I created ? I guess the plugin will somehow need to be installed first before I can link the Demo ?

Thanks

Mike

alex94040's picture
Offline
Joined: 11/06/2008

Thanks so much, Mike! What a fantastic plugin! I love it! I personally will use it in my applications!

I just installed a demo of your plugin onto the examples.qcu.be server and put a link to it onto the Plugins Listing page. It's here: http://examples.qcu.be/assets/plugins/QCaptchaTextBox/example/QCaptchaTe...

Offline
Joined: 04/04/2008

HI.
I have been using this plugin in our newer sites Love it. ...but we have a large older site on qcubed 1.0. Is it possible to put qcaptcha on that version. I have tried to upload the class files to the includes/qcodo/qform directory but the program reports an error "Class 'QCaptchaTextbox' not found" If it is possible to do this, where should the class files go. and how do I tell the program where they are?

David