[vox-tech] when is an html image "sent"?

Peter Jay Salzman p at dirac.org
Fri Dec 16 23:24:30 PST 2005


On Fri 16 Dec 05,  8:53 AM, Ted Deppner <ted at psyber.com> said:
> On Fri, Dec 16, 2005 at 10:28:40AM -0500, Peter Jay Salzman wrote:
> > is there some kind of technique I can use to make sure the image file gets
> > deleted after it's shipped off to the client?
> 
> What Rod said is typically the best (generate it inline), except you'll
> have somewhat higher CPU needs as each time a customer goes back or
> reloads the page you'll generate another image.  Also, you have to think
> about how you'll know what the key is you stuck in the image... the page
> taking the FORM must correlate with the image you generated.
 
You ain't kidding!

I've been at this for a few hours now.  It seemed "obvious" to use sessions
to store the verification string:

   <?php
   // file: captcha2.png

   // Create the string.  I've removed "0", "O".
   (snip)

   // Create image and define colors
   (snip)

   imagestring ($image, 5, 1, 1, $cmntPass, $colorBlue);
   ImagePNG( $image );
   ImageDestroy( $image );

   start_session();
   $_SESSION['captcha'] = $cmntPass;
   ?>

and display the image as:

   <img src="captcha2.php">

Where $cmntPass is the verification string.  No matter what I try, though, I
can't access sessions from the captcha2.php file.  I guess it must interfere
with the image being sent to the client.


I'm now equal parts curious and frustrated.  When using this method to show
the verification image, how DOES one pass the verification string to the
page that takes the form?

Thanks!
Pete


More information about the vox-tech mailing list