Jump to content

how to randomize images for form identapic


webguync

Recommended Posts

I am using a php based form, that I didn't develop the original code for. There is a portion of the form where you identify images as a part of a CAPTCHA type recignition. What I want to do is randomize the images so that you can add eight different images, and they show up with two different images each time on refresh.

 

here is the current code I am using:

 


<table border="0">
<tr><td colspan="3">Security test.  Please identify the pictures:</td></tr>
<tr><td><img src="images/identiPIC_1.jpg" alt=""></td><td><img src="images/identiPIC_2.jpg" alt=""></td><td><img src="images/identiPIC_3.jpg" alt=""></td></tr>
<tr><td>
<select name="identiPIC_selected[1]">
<option value="">Click to identify</option>
<option>Apple</option>
<option>Cat</option>
<option>Faucette</option>
<option>Dog</option>
<option>Flower</option>
<option>Fork</option>
<option>Hammer</option>
<option>Key</option>
<option>Ship</option>
<option>Tree</option>
</select></td><td>

<select name="identiPIC_selected[2]">
<option value="">Click to identify</option>
<option>Apple</option>
<option>Cat</option>
<option>Clock</option>
<option>Dog</option>
<option>Flower</option>
<option>Fork</option>
<option>Hammer</option>
<option>Key</option>
<option>Ship</option>
<option>Tree</option>
</select></td><td>

<select name="identiPIC_selected[3]">
<option value="">Click to identify</option>
<option>Apple</option>
<option>Cat</option>
<option>Clock</option>
<option>Dog</option>
<option>Flower</option>
<option>Fork</option>
<option>Hammer</option>
<option>Key</option>
<option>Ship</option>
<option>Tree</option>
</select></td></tr></table></td></tr>

<tr><td> 

</td><td align="right"><input type="image" src="images/Send.jpg" value="Send"></td></tr>
</table>

 

and the PHP part:

 


$identiPIC[1] = "Faucett";
$identiPIC[2] = "Keys";
$identiPIC[3] = "Lamp";

/ Check identiPIC photo CAPTCHA.

if($identiPIC_photo_CAPTCHA)
{

// Give an error if $_REQUEST['identiPIC_selected'] is not set, a bot might not send it.  If set then give an error if it is not identical to the $identiPIC array.

if(!isset($_REQUEST['identiPIC_selected'])){$errors[] = "You have failed to identify the pictures correctly.  Please try again.";}else{if($_REQUEST['identiPIC_selected'] !== $identiPIC){$errors[] = "You have failed to identify the pictures correctly.  Please try again.";} unset($_REQUEST['identiPIC_selected']);}

}

 

is there a way to add randomization?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.