M P
M P

Reputation: 915

Add captcha validation to my custom form for Frontend posting

i have implemented the frontend form, which enables UNREGISTERED users to post on my site.

Everything in working perfectly, the only problem I have is with the implementation of the captcha.

All of the captcha solutions I found needs to put some outer file in the form action. But my form has this syntax:

<form action="">

I do not know what to do? If I put the file in the action field, I cannot add the post anymore. How would I put the verification code for the captcha in the same file as the form is? Or any better solution?

Thank you very much!

Upvotes: 0

Views: 975

Answers (1)

user1928545
user1928545

Reputation:

If you know php well use the Zend Framework. I use it for all of my captcha's. Check out http://framework.zend.com/manual/2.0/en/modules/zend.captcha.operation.html for more information. It is usually used in combination with http://framework.zend.com/manual/2.0/en/modules/zend.form.quick-start.html#zend-form-quick-start so you might want to become familiar with both articles.

Also, I don't know how much traffic you get but if you are a low traffic site there are alternatives to captcha that work pretty well, and don't scare off users by the difficulty of translating the text. For example a user could solve a math problem like what is two plus two. And the bot won't be able to solve that, or you could use a blank hidden field that if the bot fills it out, then the user can't register.

EDIT: Well your best bet then is to use those alternatives. They work for 99.9% of bots and I never have issues when I use them, especially in combination. Add something like

<input type="hidden" value="" name="blah" /> 

And then test the form in php with

if (strlen($_POST["blah"]) > 0)
{
     die();
}

And that should keep out most bots. If you need more security add something like.

<p>Add two plus two</p>
<input type="text" name="check" />

and the php

if ($_POST["check"] != 4)
{
    die();
}

That should work for you.

Upvotes: 1

Related Questions