I have (what I thought was) a really simple script.
The only thing it is supposed to do is to set a cookie when it loads an image. It's not being used for anything malicious - but would be useful for tracking.
For some reason it doesn't work and I am wondering if I am not understanding how the headers are working. Here is the code.
<?
setcookie ("TestCookie", "testcookie", time() + 3600, "/", ".example.com", 0);
header("Content-type: image/png");
$im = imagecreatefromjpeg("img.jpg");
imagejpeg($im);
imagedestroy($im);
?>
For the record, the image loads just fine. It just isn't creating the cookie as I anticipated it would.