B
Brandon
Guest
I just wrote some code that will display a JPG image and show the site that was the referer to the image. This could be used to hunt down hotlinkers.
Create a document and place the following code editing the required fields. Save it as image.jpg
Then in a .htaccess file place
Now everyone who visits the image you can open referer.txt and view where people are viewing your images from.
Create a document and place the following code editing the required fields. Save it as image.jpg
PHP:
<?
//Identify as JPEG
header("Content-type: image/jpeg");
//Log File - Must be CHMOD 777
$log_file = "referer.txt";
//Get Referer
$referer = getenv('HTTP_REFERER');
//Open Log
$fp = fopen("$log_file", "a");
//Put Referer in Log
fputs($fp, "$referer
");
flock($fp, 3);
//Close Log
fclose($fp);
//Display JPG Image
$bg = imagecreatefromjpeg("Brigand.jpg");
//Output and Destroy
imagejpeg($bg);
imagedestroy($bg);
?>
Then in a .htaccess file place
HTML:
<FilesMatch "image.jpg">
SetHandler application/x-httpd-php
</FilesMatch>
Now everyone who visits the image you can open referer.txt and view where people are viewing your images from.
Last edited by a moderator: