File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes Please help me with CAPTCHA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Please help me with CAPTCHA" Watch "Please help me with CAPTCHA" New topic
Author

Please help me with CAPTCHA

chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

Hi everybody, I am Chaitanya, I am working on captcha, I have a web page where the user has to enter the captcha text. For this I am using servlets.

The procedure what I am following is:

1> A servlet will receive the request.
2> Then it creates an attribute called "passed".
3> Then using nextInt(int) method of Random class, I will generate a random integer between 0 and 100
4> There is a folder named captchaimages where all the images(jpeg) are saved.
5> The names of the images are between 0 to 100.
6> There is a mapping file, which image represents which text.
7> So depending on the random number I get, I send the number to a view.
8> The view then requests for the image.
9> After the user submits the form, with AJAX I am sending the captcha text to a servlet.
10> The Ajax code will send the image number and the text which the user entered.
11> From the mapping file I'll check whether this number maps this text or not.
12> If yes the form will be submitted or else another random number will be generated which is not equivalent to this one and the ajax response is sent back.

This is what I have in my brain, please anyone tell me whether I am going in a right way or not.

Thank you all in advance. Have a good day.


Love all, trust a few, do wrong to none.
Gian Franco
blacksmith
Ranch Hand

Joined: Dec 16, 2003
Posts: 977
Hi Chaitanya,

This will probably be relatively more difficult to maintain than
other solutions where the image is generated randomly.

Did you have a look at some existing (free) solutions?


"Eppur si muove!"
Gian Franco
blacksmith
Ranch Hand

Joined: Dec 16, 2003
Posts: 977
An open source java framework I used in a
previous project is JCaptcha it works very well.
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

Hi Mr. Gian, I googled about captcha, everywhere I go, I got details about captcha, nobody said how to implement captcha. I searched in jsp and servlets forum also. I did not get any clear information about how to do it.

Can you tell me how to do that. Is my solution a worst one?
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

Hi Mr. Gian, I searched JCaptcha examples, they were easy to understand. but one thing I did not understand is, from where the images are generated. They are not using any image folder or path of the captcha images. How the images are generated?
Gian Franco
blacksmith
Ranch Hand

Joined: Dec 16, 2003
Posts: 977
Hi Chaitanya,

...you can drop the Mr.

Your solution is fine and a good learning experience when implemented, tested
and hardened to be up to the job for what captcha is meant to be: a security solution.

In a nutshell JCaptcha, has distinct parts (i.e. java classes) with different
responsibilities for things like font generation, background generation, etc.

E.g. you can tell JCaptcha how you want your image to look like when it
comes to font, its color and the background colors as well.

hth
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

Thank you Gian. I will go with JCaptcha.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please help me with CAPTCHA