Jump to content

Integrating the free FormToEmail php script to the also free identiPic Captcha


Recommended Posts

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

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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.