<?php
// Hotlink Log and Image Watermarking Script
// Copyright (C) 2005 SillyJokes.co.uk
// DON'T EDIT THIS SECTION //////////
// action defines. Don't modify this.
define('ACTION_PASSTHROUGH',0); // pass the image through without a watermark
define('ACTION_BLOCK',1); // block the image. Send nothing.
define('ACTION_WATERMARK',2); // watermark the image
define('ACTION_SUBSTITUTE',3); // substitute the image with either the default or an image of choice.
define('NUM_ACTIONS',4);
// action names - must agree with defines - do not modify
$actionnames = array(
'passed through','blocked','watermarked','substituted'
);
define('ONEDAY',86400); // seconds in a day
////////////////////////////////////
// USER SETTINGS - edit to suit:
define('WRITELOG',TRUE); // If true, log each hotlink event to the logfile specified below.
define('ENTRYTIMELIMIT',ONEDAY); // log events older than this will not be processed. (in seconds)
define('FLUSHTIME',ONEDAY); // log events older than this will be deleted from the log
// when hotlinklogflush.php is run. (in seconds)
define('LOGFILE','../logs/hotlink.log'); // filename of log file
define('COUNTERFILE','../logs/hotlinkcount.log'); // filename of counter file
// Set the default action here. This action is performed on the image if there is no match
// found in $referrerfilterlist.
// At the moment it's set to just pass images through without processing.
// Set to ACTION_WATERMARK to watermark images by default.
define ('DEFAULT_ACTION',ACTION_PASSTHROUGH);
// Strings to check for in referrer, and the action to perform.
// more generic (and more likely) strings come first for an early match
// 'str' - a string which will be searched for in the referrer string.
// 'action' - that action to take if a match is found. See 'action defines' above.
// 'param' - optional parameter for action. For example, ACTION_SUBSTITUTE will
// use 'param' as the substitute image filename, overriding $defaultsubimage.
$referrerfilterlist = array(
array('str'=>'forum', 'action'=>ACTION_WATERMARK),
array('str'=>'blog', 'action'=>ACTION_WATERMARK),
array('str'=>'showtopic', 'action'=>ACTION_WATERMARK),
array('str'=>'viewtopic', 'action'=>ACTION_WATERMARK),
array('str'=>'showthread', 'action'=>ACTION_WATERMARK),
array('str'=>'message_topic', 'action'=>ACTION_WATERMARK),
array('str'=>'/boards/', 'action'=>ACTION_WATERMARK),
array('str'=>'/topic/', 'action'=>ACTION_WATERMARK),
array('str'=>'myspace.com', 'action'=>ACTION_WATERMARK),
array('str'=>'ultimatebb', 'action'=>ACTION_WATERMARK),
array('str'=>'ubbthreads', 'action'=>ACTION_WATERMARK),
array('str'=>'ezboard', 'action'=>ACTION_WATERMARK),
array('str'=>'livejournal', 'action'=>ACTION_WATERMARK),
array('str'=>'fark.com', 'action'=>ACTION_WATERMARK),
array('str'=>'ebay.co', 'action'=>ACTION_WATERMARK),
// examples of ACTION_SUBSTITUTE
// Substitute default image ($defaultsubimage):
// array('str'=>'westwindnet.com', 'action'=>ACTION_SUBSTITUTE),
// Substitute a specific image:
// array('str'=>'westwindnet.com', 'action'=>ACTION_SUBSTITUTE, 'param'=>'sausage.jpg'),
);
// default image to substitute
$defaultsubimage = 'bacon.jpg';
// which font and caption to use depending on hotlinked image width.
// 'font' refers to the fonts built in to PHP's graphics library (the imagestring() PHP function)
// if the width of the hotlinked image is less than the smallest in this table, the image is not watermarked.
$watermarksettings = array(
array('width'=>170, 'font'=>3, 'caption'=>'(c) www.SillyJokes.co.uk'),
array('width'=>124, 'font'=>1, 'caption'=>'(c) www.SillyJokes.co.uk'),
array('width'=>75, 'font'=>1, 'caption'=>'(c) SillyJokes'),
);
?>