Use NATS as your processinmg script and it's built into the system ;-)
otherwise, you can probably find a coder to do you an FHG script fairly cheap, all it has to do is pass the affiliate code to the links going to the site
example: the affiliate's ID is "xxxhoney"
then the link on the gallery would be
http://www.anotherpornsite.com/?xxxhoney, where xxxhoney was passed to the link