Not logged in? Join one of the bigest Law Forums on the Internet! Join Now!   Latest blog post: Research Law Professors Before Choosing Law Schools

Advertisments:




Sponsor Links:

Discount Legal Forms
Discounted Legal Texts


Making Captcha work with Register button?

Dealing with a class action? Discuss it here

Making Captcha work with Register button?

Postby gwynethpaltrow8 » Tue May 22, 2012 4:49 pm

It's difficult to ask this without the ability to provide a link or PHP files. I am using a randomly generated numerical captcha on my registration page. I only want one form, two actions, one button. The HTML form code follows, with the form action calling the php file and you can see the captcha involvement toward the end:

<form id="FormName" action="query.php" method="post" name="FormName">
<p id="FormName-userName">
<label for="userName">User Name</label><input name="userName" class="inputbox" size="18" maxlength="25" type="text" value=""></p>
<p id="FormName-passWord"><label for="passWord">Password</label><input name="passWord" class="inputbox" size="18" maxlength="25" type="text" value=""</p>
<p id="FormName=realName"><label for="realName">Real Name</label><input name="realName" class="inputbox" size="18" maxlength="50" type="text" value="">
<p id="FormName=emailAddress"><label for="emailAddress">Email Address</label><input name="emailAddress" class="inputbox" size="18" maxlength="50" type="text" value=""></p>
<p align="center">Type the code shown into the field below it and click the Register button to complete your registration.</p>
<p align="center"><img id="captcha" src="captcha_show.php" alt="CAPTCHA Image" /></p>
<p align="center"><input type="text" name="captcha_code" size="10" maxlength="6" />
<a href="#" onclick="document.getElementById('captch… = 'captcha_show.php?' + Math.random(); return false">[ Different Image ]</a></p>
<p align="center"><button type="submit" class="validate">Register</button>
or <a href="/home" title="Cancel">Cancel</a><input name="option" value="" type="hidden"></p>
</form>

As it is now, it functions, in that it inserts the registration data with an ID into my tables when the captcha is entered correctly. However, it also inserts an additional blank ID. If I purposely enter the captcha image incorrectly, no registration data is entered into the tables, however, a blank ID is still inserted.

So.... this is the dual function of the one button causing this, right? The blank ID being inserted is the Register action trying to happen, while Captcha intercepts the data? How does one stop this?


Note: the query.php files calls for an include of the captcha.php file as follows: include_once $_SERVER['DOCUMENT_ROOT'] . 'captcha.php';

There is also a session start string. As I mentioned, the basic function is working, i.e., registration data being inserted into tables with correct captcha answer and no registration data being inserted, if incorrect. But an additional blank ID entry is also being inserted, with each registration attempt, whether the captcha answer is correct or incorrect. This makes me suspect the "one button" function.

I realize you're working blind without the files or link, but I'm unsure of how to provide those and don't wish the link to my site to be posted here, where I cannot delete it at a later date.

Thank you so much, for any light you can shed on this. :)
gwynethpaltrow8
 
Posts: 12
Joined: Fri Apr 01, 2011 10:57 pm
Top

Making Captcha work with Register button?

Postby barraq » Tue May 22, 2012 4:50 pm

The issue is with your processing script. You are not error checking properly. You need to make sure that there are not input errors, or empty inputs, before you add the info to your database.


Cheers,
Gitlez
barraq
 
Posts: 13
Joined: Fri Apr 01, 2011 10:55 am
Top


Return to Class Action

 


  • Related topics
    Replies
    Views
    Last post