I plan on adding a logo image to an email newsletter and use it as a tracking image. This image will be hosted on my site (eg. my_logo.gif) and referenced in the html of the email (eq. <img src="http://www.example.com/my_logo.gif" />). I would like to create a script in php that emails me when that image is accessed/viewed. Is this possible? If so, how?
All ideas and suggestions to complete this are welcome.
Put something like this in an
.htaccessfile in the image directory:Put something like this into a file
image.phpin the same directory:This is only a simple example, make sure you validate the
$_GET['image']variable to make sure it’s an image in the same directory, otherwise someone might be able to abuse this script to read files in other directories (image.php?image=../../../passwords).