Question : PHP: adding a unique code to JPG image during download (embedded in the file)

I'm the owner of a stock photography website. One of my visitors is uploading my images to a warez site. I have firm suspicions who is doing this, but I'd like to confirm them.

For this I want to insert a user-id and the IP address to the file. That way I can backtrack the user once the images appear on the warez site.

The code that handles the file download looks more or less like this:

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
// send headers
header("Content-type: $mimetype");
header("Content-length: $filesize");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".$filesize);
header("Content-disposition: attachment; filename=\"" . urlencode(basename($file)) ."\"" );

$handle = fopen($file, "rb");
if(!$handle) errpic("Unable to open file");
while(!feof($handle)){
	echo fread($handle, 16384);
	flush();
}


I tried appending the user-id to the end of the file, but this did not work. The file remained exactly the same size (I increased the filesize header as well)

1:
2:
echo 'uid:'.$userid . ' IP:' .$_SERVER['REMOTE_ADDR'];
flush();

 
How can I add a user-id and IP address to the end of a JPG image? (Without breaking the image).
My site has a lot of users, so it needs to be a solution that does not take much performance.

Answer : PHP: adding a unique code to JPG image during download (embedded in the file)

I only have version 12 here.

Try searching the registry for "Agent Directory List" that might do it.
Random Solutions  
 
programming4us programming4us