1

I have a banner in my signature in a forum and I would like to track the number of views it had. I am willing to use PHP GD to encode and an image and increment my counter every time it's accessed.

here's my code for banner.php now (havent implemented the counter):

<?php
  header('Content-encoding: none');
  header("content-type:image/jpg");
  header("Cache-Control: private, no-cache, no-cache=Set-Cookie, proxy-revalidate");
  header("Expires: Wed, 11 Jan 2000 12:59:00 GMT");
  header("Last-Modified: Wed, 11 Jan 2006 12:59:00 GMT");
  header("Pragma: no-cache");
  // Create an image, 728x90 pixel in size
  $im=imagecreate(728,90);

  // Set the background colour
  $black=imagecolorallocate($im,0,0,0);

  // Allocate the background colour
  imagefilledrectangle($im,0,728,0,90,$black);

  // Create a JPEG file from the image
  imagejpeg($im);

  // Free memory associated with the image
//  imagedestroy($im);

?>

The problem is that it seems that my browser is caching this, and as a result, not loading the code everytime the page is called in a img tag.

Any help would be greatly appreciated.

None
  • 302
  • 3
  • 20

0 Answers0