I can't exactly tell what your code doing, but here is how it works. You send an email with the img src tag pointing to your php program.
<img src="http://yourserver/test.php?email=thiers@theirs.com">
That's it (or include whatever url variables you want, but make sure you understand that you have to send those varables to them, you cannot expect PHP to run inside of their email on their workstation). Once they open it, you can tell your PHP to get $REMOTE_IP, etc. and then place that in your DB.
Now you can of course decide to display an image (clear or not), or you don't have to, but if you don't, that img src will be a broken image with a red x. That's just poor programming. So if you don't want anything to show, <img src="file.php" width=0 height=0>, and no image. However if you want to show an image, then send one back to them after you process the info and stick it in your DB. Put this at the end of your script to send back an image. Remember that everything is relative to their workstation, so it must be a full url path, and not just "logo.gif".
$image = fread(fopen("http://www.yourserver.com/images/logo.gif", "r"), 1000000);
Header("Content-type:image/gif");
print $image;
As a Note: Recently it has been brought to my attention that developers like SquirrelMail (written in PHP) are blocking IMG tags with full url paths, and making end users click on a link in order to view that image. So if they don't, you won't get your data. Something to consider...