html img src call php script to randomly generate and dump. Human Validator.

I have 5 image tags in a row on one page that looks something like this:

<img src="/getVerifyPics.php5" id="" class="humanPics" alt="" onclick="" />

for now I’ll stick to just one.

the getVerifyPics.php5 file looks like this

[php]

<?php // names of the array, 5 images $letter = array("A", "B", "C", "D", "E"); //first half shuffle($letter);//shuffle images by parts $number = array(); //second half for ($i=0; $i<=4; $i++) { $number[$i] = rand(1,3);//5 random numbers 1-3 stored in num0 to num4 } shuffle($number); //put the pieces together; randomly ordered picture files $img = array(); for ($pi=0; $pi<=4; $pi++) { $img[$pi] = "/VerifyPics/" . $letter[$pi] . $number[$pi] . ".jpg"; } shuffle($img); //one last shuffle for good measure $fp = fopen($img[0], 'rb'); //headers header("Content-Type: image/jpeg"); header("Content-Length: " . filesize($img[0])); //dump and exit fpassthru($fp); exit; ?>[/php]

I’m having a few problems, mainly because I am not proficient in php. I’m getting an error when I dot ‘/VerifyPics/’ with the letter, number and ‘.jpg’. I need to change the root directory so that my image file can actually be found, chroot perhaps? Also the whole point of this is to have 5 imgs, call the php script to randomly generate 5 srcs out of a possible 15 (A1.jpg or A2.jpg or A3.jpg, B1.jpg or B2.jpg… or E3.jpg). Please help!

P.S. this is for a human validator tool that I am working on.

Sponsor our Newsletter | Privacy Policy | Terms of Service