Please Help! passing string back and forth between html img src and php script

So I have an html page with 5 images that look like this:

<img src="/getVerifyPics.php5?HVid=0&HVlet=<?php echo $letters; ?>" id="HV0" class="humanPics" alt="" onclick="javascript:humanVerify('HV0')" /><img src="/getVerifyPics.php5?HVid=1&HVlet=<?php echo $letters; ?>" id="HV1" class="humanPics" alt="" onclick="javascript:humanVerify('HV1')" /><img src="/getVerifyPics.php5?HVid=2&HVlet=<?php echo $letters; ?>" id="HV2" class="humanPics" alt="" onclick="javascript:humanVerify('HV2')" /><img src="/getVerifyPics.php5?HVid=3&HVlet=<?php echo $letters; ?>" id="HV3" class="humanPics" alt="" onclick="javascript:humanVerify('HV3')" /><img src="/getVerifyPics.php5?HVid=4&HVlet=<?php echo $letters; ?>" id="HV4" class="humanPics" alt="" onclick="javascript:humanVerify('HV4')" />

And my getVerifyPics.php5 looks like this, but it’s creating the string of letters and re-shuffling it everytime, which results in a random sequence of letters. I need it to save the string and re-use it for every image, so that no letters are repeated.
[php]

<?php //check variables $theID = $_REQUEST["HVid"]; if (isset($theID) && $theID != NULL && $theID != "") { $id = $theID; } else { echo "HV image id is not set; behave."; exit; } //prepare file names $lets = unserialize($_REQUEST["HVlet"]); //first half //if $letter is shuffled every time there could be more than one occurrence if (!isset($lets) || $lets == NULL || $lets == "") { $letter = array("A", "B", "C", "D", "E"); shuffle($letter); } $number = rand(1,3); //second half //put the pieces together $img = "VerifyPics/" . $letter[$id] . $number . ".jpg"; $fp = fopen($img, 'rb'); //headers header("Content-Type: image/jpeg"); header("Content-Length: " . filesize($img)); //dump, pass shuffled letter array and exit fpassthru($fp); $letters = $_POST[serialize($letter)]; exit; ?>[/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service