Topic: Damn PHP

So I'm trying to implement Captcha on a website.
Got a site that starts a session writes stuff to it.
Got a php file that generates a PNG file and puts the Captcha value in the session.
Since my scripts generates a PNG file I just have to do <img src="./myphpscript.php"> to show the picture. That works.

The problem is my session doesnt exist in the script if I call it via <img src>. Any idea why and what I could do ?
I tried session_start in the script but it doesnt help.

Thanks for your time guys!

<wintellect> NetBSD users are smart enough to accept that there's no 3D support tongue

Re: Damn PHP

Next solution is to use include instead of <img src> and create the png file with a random name and delete it after use.

<wintellect> NetBSD users are smart enough to accept that there's no 3D support tongue

Re: Damn PHP

dynek wrote:

The problem is my session doesnt exist in the script if I call it via <img src>. Any idea why and what I could do ?
I tried session_start in the script but it doesnt help.

sorry, but i have a hard time believing this.

is this well documented?

Re: Damn PHP

How about turning the myphpscript.php into a function that returns an image or returns the entire <img= tag.

Last edited by RoddieRod (2007-11-28 21:45:09)

"An educator never says what he himself thinks, but only that which he thinks it is good for those whom he is educating to hear."
-Nietzsche

Re: Damn PHP

How about returning the image inline: <img src="data:image/png;base64,stahoeuscdj5jqkstheau..."/>

Re: Damn PHP

ok found the problem. the save_handler was set to database.

<wintellect> NetBSD users are smart enough to accept that there's no 3D support tongue