FayeC Posted May 28, 2009 Share Posted May 28, 2009 Hi, I am trying to integrate the free FormtoEmail script (http://formtoemail.com/) to the free identiPic captcha (http://identipic.com/) both written by Charles Sweeney. The identiPic info says we can just drop it before the form php script but when I do so it make the form skip all the validation. For example, if the captcha is added and the user inserts the correct value for the captcha image and submits an empty form, the form doesn't validate against anything and submits an empty form. When the captcha is not added the form validates agains injection, empty fields, etc. Has anybody integrated the two successfully? Thank you, FayeC Quote Link to comment https://forums.phpfreaks.com/topic/160055-integrating-the-free-formtoemail-php-script-to-the-also-free-identipic-captcha/ Share on other sites More sharing options...
BobcatM Posted May 28, 2009 Share Posted May 28, 2009 Post the code and maybe we can help you out. Quote Link to comment https://forums.phpfreaks.com/topic/160055-integrating-the-free-formtoemail-php-script-to-the-also-free-identipic-captcha/#findComment-844373 Share on other sites More sharing options...
FayeC Posted May 29, 2009 Author Share Posted May 29, 2009 The code for the form is at: http://formtoemail.com/FormToEmail.txt It was too long to paste here. I wasn't sure I could do that. The code for the captcha is: <?php if(!isset($_REQUEST['identiPIC_answer']) || strlen($_REQUEST['identiPIC_answer']) > 15){exit;} $identiPIC_solutions = array('bicycle','bike'); foreach($identiPIC_solutions as $value) { if(stristr($_REQUEST['identiPIC_answer'],$value)){$set = 1; break;} } if(!$set){print "You have failed to identify the picture correctly. Please try again."; exit;} // Continue with the rest of your script ?> I added the code to the top of the form script and it causes the form not to validate properly. It allows the form to be sent even if the fields are empty. Then I realized that the blank form validation validates for the full form being empty and not each field being empty so since the captcha is part of the form and was being filled then that made the check to pass.......so I might need to add validation for required fields as well. That is for another round though. The focus is to get the form to validate first then IF the captcha is correct then continue to create the message. I tried adding the code below the blank check and above the error check and removed one of the exit; but that didn't help....I am thinking that the code needs to be completely rewritten to be integrated with the form. Please forgive my stumbling about in PHP. I am a newbie at it and although I can understand the logic and the loops I can't write from scratch so I try to modify available code. Most of the time if it's small mods I can tackle but this one is confusing me to no end. Thank you in advance, FayeC Quote Link to comment https://forums.phpfreaks.com/topic/160055-integrating-the-free-formtoemail-php-script-to-the-also-free-identipic-captcha/#findComment-844608 Share on other sites More sharing options...
BobcatM Posted May 29, 2009 Share Posted May 29, 2009 Let me see your form code please. Quote Link to comment https://forums.phpfreaks.com/topic/160055-integrating-the-free-formtoemail-php-script-to-the-also-free-identipic-captcha/#findComment-844917 Share on other sites More sharing options...
FayeC Posted May 29, 2009 Author Share Posted May 29, 2009 The form code is included (it's in the code I sent above. I didn't modify it) is: <form action="FormToEmail.php" method="post"> <table width="100%" border="0" cellspacing="5" style="background:#ffffff"> <tr><td>Name</td><td><input type="text" size="30" name="name"></td></tr> <tr><td>Email address</td><td><input type="text" size="30" name="email"></td></tr> <tr><td valign="top">Comments</td><td><textarea name="comments" rows="6" cols="30"></textarea></td></tr> <tr> <td> </td> <td> <table> <tr><td>Security test. Please identify the picture:</td></tr> <tr><td><img src="identiPIC_4.jpg" alt=""></td></tr> <tr><td><input type="text" name="identiPIC_answer"></td></tr> </table> </td> </tr> <tr><td> </td><td><input type="submit" value="Send"></td></tr> </table> </form> Thank you for taking the time to look through it. FayeC Quote Link to comment https://forums.phpfreaks.com/topic/160055-integrating-the-free-formtoemail-php-script-to-the-also-free-identipic-captcha/#findComment-844991 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.