<?php
// Hotlink Log and Image Watermarking Script
// Copyright (C) 2005 SillyJokes.co.uk
// This file is called by hotlinklog.php to show a list of
// referrer links for a given image and domain
require 'hotlinklogconfig.php';
require 'hotlinklogfuncs.php';
set_time_limit(120);
$f = fopen(LOGFILE,'r');
$files = array();
$referrers = array();
$img = $_REQUEST['img'];
$sucker = $_REQUEST['sucker'];
echo "Searching for $img linked by $sucker<br/>";
if (file_exists($img))
{
list($width, $height) = getimagesize($img);
$imglink = stristr($img,'/images')."?thing=".time();
$newheight = 64;
$newwidth = $width * 64/$height;
echo "<a href='$imglink' target='_blank'><img src='$imglink' width='$newwidth' height='$newheight' border='0'></a><br/>";
}
while (!feof($f))
{
$buf = fgets($f);
$guff = MungLogLine($buf);
if ($guff===FALSE)
{
continue;
}
extract($guff); // makes $filename, $time, $action, $referrer
if (EntryTooOld($time))
{
continue;
}
if (!($filename == $img && ExtractDomain($referrer) == $sucker))
{
continue;
}
echo "<a href='$referrer' target='_blank'>$referrer</a><br/>";
}
fclose($f);
?>